Create/Update Admin (upsert)
An overview of the Create/Update Admin endpoint
Endpoint Description
This endpoint allows you to create or update a company users.
HTTP Method
POST /api/v2/admins/{companyId}
Request
Headers:
Content-Type:
application/json
- Specifies that the request body format is JSON.Accept:
application/json
- Indicates that the client expects a JSON response.Authorization:
Bearer {token}
- A valid Bearer token must be provided to authenticate the request.
URL Parameters
companyId (integer, required): The id of the company (subscription) to create or update Admin data. Example: 1234
Query Parameters:
admin_id (string, required): A unique identifier for the admin from the integration partner system. This ID must be unique within R1 Discover. (ex. R1-TechPartnerCode-SharedAdminCode-0001). If it doesn't match it a new admin will be created.
admin_email (string, required): The email address of the admin, STRONGLY RECOMMENDED, but not required. System will return a password in the response if an email is not included.
admin_username (string, optional): The global username for the admin. This must be unique across the R1 Discover system, see the Check Global Username Availability endpoint. You may also leave this blank and the system will autogenerate a username.
first_name (string, optional): The first name of the admin. Example: John
last_name (string, optional): The last name of the admin. Example: Doe
admin_role (string, optional): The role of the admin, default Admin-Read (See Admin Roles Endpoint). Required for creating a new admin. Example: "Admin-Read" admin_type (string, optional): The admin type of the admin, required for creating a new admin. Required for creating a new admin. Example: Practitioner
admin_location (string, optional): The primary location of the admin within the company. Required for creating a new admin. See List Company Locations.
admin_program (string, optional): The program to which the admin is aligned. Required for creating a new admin. See List Company Programs.
admin_status (string, optional): Indicates whether the user account is active or inactive. Required for creating a new admin.
Request Examples
curl --request POST \
"https://api.r1learning.com/api/v2/admins/1" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer {token}" \
--data "{
\"admin_id\": \"r1-admin-123456-01\",
\"admin_email\": \"[email protected]\",
\"admin_username\": \"admin123\",
\"first_name\": \"John\",
\"last_name\": \"Doe\",
\"admin_role\": \"\\\"Admin-Read\\\"\",
\"admin_type\": \"Practitioner\",
\"admin_location\": \"AZ Treatment Center\",
\"admin_program\": \"PHP\",
\"admin_status\": \"active\"
}"
Response
Data Dictionary:
id (integer): The unique id of the admin within the R1 Discover platform.
unique_id (string): The unique identifier for the admin from the integration partner system.
username (string): The global R1 Discover username for the user.
first_name (string): The first name of the user. Example: John
last_name (string): The last name of the user. Example: Doe
admin_email (string): The email address of the admin.
admin_role (string): The permissions role assigned to the admin
admin_type (string): The admin type of the admin.
location (string): The location where the user is aligned.
program (string): The program where the user is aligned.
status (string): Indicates the user license status (active/inactive)
created_at (date): Indicates when the admin account was created
Response Examples
{
"error": 0,
"message": "Admin created successfully",
"data": {
"unique_id": "abcxyz",
"username": "johndoe",
"first_name": "John",
"last_name": "Doe",
"admin_email": "[email protected]",
"admin_role": "Admin-Read",
"admin_type": "Company Admin",
"admin_location": "R1 Location 1",
"admin_program": "General",
"admin_status": "active",
"created_at": "2024-08-30T14:30:00Z"
}
}
Postman Link
Notes
Authorization Required: Ensure the provided Bearer token is valid and has sufficient privileges to access the endpoint.
Last updated