Accounts & Users: 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 Parameters

  • tenant_name (required): Name of the account

Response

UUID of the account of the tenant created.

Example

Request

/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.

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"
}
]
},...

 

Retrieve info about current account

Get info about current tenant.

Summary

  • Endpoint: /tenant_read
  • Method: GET
  • Required User Type: None, this works for all users
    • This even works for super users/admin, but they must be within a tenant

Response

A successful response will return an object containing information about the tenant.

Example

Response Data:

{"city": "Tokyo", 
"fax": null,
"stripe_allowed_plans":["*"],
"api_basic_user": "t_11111111-1111-1111-1111-111111111111",
"zip": null, "account_types": ["11111111-1111-1111-1111-111111111111"],
"tenant_id": "11111111-1111-1111-1111-111111111111",
"created_at": 1541456616,
"enabled": true,
"child_tenant_mapping": [{"id": "22222222-2222-2222-2222-222222222222"}],
"created_by": "dev@mediumone.com",
"parent_tenant_mapping": [],
"country": null,
"state": null,
"street": null,
"image_url": null,
"tenant_name": "Test Tenant",
"logo_url": null,
"street2": null,
"device_mapping": [
{"login_id": "st_11111111-1111-1111-1111-111111111111"},
{"login_id": "st_22222222-2222-2222-2222-222222222222"}]

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 Parameters

  • 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 if successful

Example

Request Body

{
"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 Parameters

  • tenant_id (required): ID of the account

Response

UUID of the account of the tenant deleted.

Example

Request

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

Response Data

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