The following are user-related endpoints.
Create a user
This endpoint is used by SA to create a user without a tenant role (ie. no tenant assignment). Tenant roles need to be added in a subsequent call to /tenant_add_user by SA or /user_add by TA. If the user does not exist, a Welcome Email will be sent to the user with an auto-generated password.
Summary
- Endpoint: /user_create
- Method: GET
- Required User Type: SA or TA
URL Parameters
-
user_name (required): username in email format
-
full_name (required): full name of user
-
language: language preference
-
Default: "en"
-
Response
UUID of the user if user is created.
400 Bad Request if user already exists.
Example
Request
/user_create?full_name=Test+User&user_name=testuser@mediumone.com
Response Data
"946a453f-da88-44dd-8885-d5461f5e07a1"
Create user link to tenant
This is a common endpoint used to add a user to a tenant. This can be used to add an existing user to a tenant or to create a new user and link it the tenant.
Summary
- Endpoint: /tenant_add_user
- Method: GET
- Required User Type: TA or SA
URL Parameters
- tenant_id - UUID for tenant
- Required by SA
- Type: string
- user_name - user email for login
- Required
- Type: string
- You need to encode the email for the URL
- role - user role in the target tenant, either "tenant-admin" or "tenant-user"
- Required
- Type: string
- full_name - user's name for displaying, it will be used to create user when the user doesn't exist in the system
- Required by TA
- Type: string
Response
A successful response will return null.
Example
SA Request
/tenant_add_user?tenant_id=b57f1307-02d6-4294-aba9-27fa12cb8049&role=tenant-admin&user_name=example%40example.com
TA Request
/tenant_add_user?role=tenant-admin&user_name=example%40example.com&full_name=exampleUser
Response Data
null
Retrieve list of users in a tenant
You can use the following endpoint within your custom pages in order to get a list of basic information for all users linked to the tenant.
Summary
- Endpoint: /user_list_in_tenant
- Method: GET
- Required User Type: SA or TA
- TA can only query users linked to the current tenant
URL Parameters
- tenant_id - UUID for tenant
- Only Required by SA
- Type: string
- The UUID is the tenant_id, or the basic user for the tenant without the "t_"
Response
A successful response will return an array of objects in the "user_list" tag of the response.
Each of the objects represents a different user
Example
SA
/user_list_in_tenant?tenant_id=3f1a5b4d-5e64-48d4-abab-8ead052fad1e
TA
/user_list_in_tenant
Response Data:
{
"user_list":[
{
"full_name": "John",
"user_name": "john@example.com",
"user_id": "1fdf2fd2-b198-490e-8b6c-ab8f787fef4c",
"api_basic_user": "u_1fdf2fd2-b198-490e-8b6c-ab8f787fef4c",
"tenant_roles": [
{
"tenant_role": "tenant-admin",
"tenant_id": "3f1a5b4d-5e64-48d4-abab-8ead052fad1e",
"tenant_name": "test tenant"}
]
]
}
Retrieve a list of all users
This is only for SA. Useful if building a custom Manage Users page.
Summary
- Endpoint: /user_list
- Method: GET
- Required User Type: SA
Response
A successful response will return an array of objects in the "user_list" tag of the response.
Each of the objects represents a different user
Example
Request
/user_list
Response Data
[
{
"full_name": "App Test",
"user_name": "test@medium.one",
"user_id": "fdc0487f-a0ff-4e2c-8df1-957936ec9350",
"api_basic_user": "u_fdc0487f-a0ff-4e2c-8df1-957936ec9350",
"tenant_roles": [
{
"tenant_role": "tenant-admin",
"tenant_id": "8a5107f0-43f6-4b1a-9326-bbd684f13646",
"tenant_name": "Test User"
}
]
}
...
]
Retrieve info about current user
This will give you info about the current logged in user.
Summary
- Endpoint: /whoami
- Method: GET
- Required User Type: None, this works for all users
Response
A successful response will return the following string tags:
- user_id - UUID for the user
- api_basic_user - user's Medium One basic user, will always begin with "u_"
- user_phone - phone number if user has provided it, else null
- role -"tenant-user", "tenant-admin", "super-user", or "super-admin"
- full_name - name on record for the user
- user_name - email address user uses to log in
Example
Request
/whoami
Response Data:
{"user_id": "11111111-1111-1111-1111-111111111111",
"api_basic_user": "u_11111111-1111-1111-1111-111111111111",
"user_phone": "111-111-1111",
"role": "tenant-admin",
"full_name": "Alexa F.",
"user_name": "support@mediumone.com"}
Retrieve info about current user's linked accounts
You can use the following endpoint within your custom pages in order to get the role and tenant of the current user.
Summary
- Endpoint: /myrole
- Method: GET
- Required User Type: None, this works for all users
Response
A successful response will return a dictionary of your roles and account access.
Example
Request
/myrole
Response Data
{
"tenant_roles": [
{
"tenant_role": "tenant-user",
"tenant_id": "490b177e-0576-41d0-858b-1e45e39345b6",
"tenant_name": "Test Account"
}
],
"current_tenant_id": "490b177e-0576-41d0-858b-1e45e39345b6",
"current_tenant_name": "Test Account",
"current_tenant_role": "tenant-user"
}
Update a user
This endpoint will update a user. You can use this to change the user fields as well as changing their role.
Summary
- Endpoint: /user_update
- Method: GET
- Required User Type: SA or TA
Params
- user_name (required): username in email format
- param_list: {"field":"<field1>","value":"<value1>"}
- param_list: {"field":"<field1>","value":"<value2>"}
- ...
Response
null
Example
The following example updates a user with the following params
- param_list={"field":"full_name","value":"Mr Smith"}
- param_list={"field":"user_phone","value":"8888888888"}
- param_list={"field":"street","value":"1 Ocean"}
- param_list={"field":"street2","value":"Apt 1"}
- param_list={"field":"city","value":"Santa Cruz"}
- param_list={"field":"state","value":"CALIFORNIA"}
- param_list={"field":"zip","value":"95062"}
- param_list={"field":"country","value":"United States"}
- user_name=testuser+8@medium.one
Request
/user_update?param_list=%7B%22field%22:%22full_name%22,%22value%22:%22Mr+Smith%22%7D¶m_list=%7B%22field%22:%22user_phone%22,%22value%22:%228888888888%22%7D¶m_list=%7B%22field%22:%22street%22,%22value%22:%221+Ocean%22%7D¶m_list=%7B%22field%22:%22street2%22,%22value%22:%22Apt+1%22%7D¶m_list=%7B%22field%22:%22city%22,%22value%22:%22Santa+Cruz%22%7D¶m_list=%7B%22field%22:%22state%22,%22value%22:%22CALIFORNIA%22%7D¶m_list=%7B%22field%22:%22zip%22,%22value%22:%2295062%22%7D¶m_list=%7B%22field%22:%22country%22,%22value%22:%22United+States%22%7D&user_name=testuser%2B8@medium.one
Response Data
null
Delete a user
This endpoint will delete a user from the portal.
Summary
- Endpoint: /user_remove
- Method: GET
- Required User Type: SA or TA
Path
- user_name (required): username in email format
Response
null
Example
SA
/user_remove?user_name=testuser@mediumone.com
Response Data:
null
Delete a user from tenant
This endpoint will delete a user from the tenant, however the user will still exist in the portal.
Summary
- Endpoint: /tenant_remove_user
- Method: GET
- Required User Type: SA or TA
Path
- tenant_id - UUID for tenant
- Required by SA
- Type: string
- user_name - user email for login
- Required
- Type: string
- You need to encode the email for the URL
Response
A successful response will return null.
Example
SA Request
/tenant_remove_user?tenant_id=b57f1307-02d6-4294-aba9-27fa12cb8049&user_name=example%40example.com
TA Request
/tenant_remove_user?user_name=example%40example.com
Response Data
null