CRUD Accounts

The following are account-related endpoints.

Create an account

This endpoint is used by SA to create an account.    

Summary

  • Endpoint: /tenant_create
  • Method: GET
  • Required User Type: SA

Path

  • tenant_name (required): Name of the account

Response

UUID of the account of the tenant created.

Example

SA

/tenant_create?tenant_name=Test

Response Data:

03b9e9aa-1cc6-4da0-b29d-157912a821db

 

Retrieve a list of accounts

Get a list of all accounts.

Summary

  • Endpoint: /tenant_list
  • Method: GET
  • Required User Type: SA or TA
    • TA can only query accounts linked to that user

Response

A successful response will return an array of account objects.

Details of each object:

  • api_basic_user - api basic user id for tenant in platform
    • Type: string
  • tenant_id - UUID for tenant
    • Type: string
    • The UUID is the tenant_id, or the basic user for the tenant without the "t_"
  • tenant_name - display name of that tenant
    • Type: string
  • num_of_devices - number of devices linked to that tenant
    • Type: integer
  • num_of_users - number of users linked to that tenant
    • Type: integer
  • account_types - array of strings which represent the account types for that tenant
    • Type: array
  • num_of_users - array of dictionaries which represent the login_id (api basic user) for each linked devices
    • Type: array

Example

SA

/tenant_list

Response Data:

[
{
"child_tenant_mapping": [
],
"custom_params": {
"partner_id": "1"
},
"api_basic_user": "t_c0f9e8fb-5171-4ace-9fd7-c36d7c879ba7",
"account_types": [
"f74f92f6-207b-4381-894c-a0bcdb01cd76"
],
"tenant_name": "Test",
"num_of_users": 2,
"num_of_devices": 2,
"tenant_id": "c0f9e8fb-5171-4ace-9fd7-c36d7c879ba7",
"device_mapping": [
{
"login_id": "d_9cfe21bf-f15a-45af-ab7b-4be84bb66b35"
},
{
"login_id": "device01"
}
]
},...

  

Update account

This endpoint will update an account.  You can use this to change the account fields.

Summary

  • Endpoint: /tenant_update
  • Method: POST
  • Required User Type: SA

Body

  • tenant_id (required): account id
  • tenant_name (optional): account name
  • account_types (optional): list of account types assigned to this account
  • stripe_allowed_plans(optional): list of stripe billing plans for this account
  • street (optional): address field
  • street2 (optional): address field
  • city (optional): address field
  • state (optional): address field
  • zip (optional): address field
  • country (optional): address field
  • custom_params (optional): a dictionary for any custom fields

Response

null

Example

The following example updates a tenant with the following params

{
"tenant_id": "6e64540c-6417-41e2-b32d-f7cbc681cfca",
"tenant_name": "Test Account",
"account_types": [
],
"stripe_allowed_plans": [
],
"street": "1 Ocean",
"street2": "Suite 1",
"city": "Santa Cruz",
"state": "CA",
"zip": "95060",
"country": "USA",
"custom_params": {
"partner_id": "0"
}
}

Response Data:

null

 

Delete an account

This endpoint is used by SA to delete an account.    

Summary

  • Endpoint: /tenant_remove
  • Method: GET
  • Required User Type: SA

Path

  • tenant_id (required): ID of the account

Response

UUID of the account of the tenant deleted.

Example

SA

/tenant_delete?tenant_id=3e8f87cd-5f4e-476b-8d10-d183d95a1c40

Response Data:

3e8f87cd-5f4e-476b-8d10-d183d95a1c40