Update User

An overview of the Update User endpoint.

Endpoint Description

The "Update User" endpoint allows for modifying existing user records within the R1 Discover system. It provides a means to keep user information current and accurate, encompassing updates to locations, program assignments, practitioner alignments, and user status.

HTTP Method

PUT /api/v1/companies/{companyId}/users/{clientId}

Headers

  • Content-Type: application/json - Indicates that the request body format is JSON.

  • Accept: application/json - Specifies that the client expects to receive data in JSON format.

  • Authorization: Bearer {token} - Requires a valid bearer token to authenticate and authorize the modification request.

URL Parameters

  • companyId (integer): The identifier for the company to which the user belongs. This parameter must match an existing company in the R1 Discover database.

  • clientId (string): The unique identifier (unique_id) for the user, provided by an integration partner system. This ID must correspond to an existing user within R1 Discover. See Company User List to get user details including the unique_id.

Body Parameters

  • username (string, optional): The unique username for the user. This must remain unique across R1 Discover and is used for identification and login purposes. See Check Global Username Availability.

  • company_username (string, optional): An alternative username that may be used within specific company contexts, particularly where user identification differs from the global setting. See Check Company Username Availability.

  • client_email (string, optional): The email address of the user, used for communications and account recovery. Must be unique within R1 Discover.

  • client_location (string, optional): The location the user is aligned to within the company. See View Company Locations.

  • client_program (string, optional): The program to which the user is assigned within the company. see View Company Programs.

  • client_practitioner (string, optional): The email address of the practitioner or counselor assigned to the user, see View Company Practitioners.

  • client_status (string, optional): Indicates whether the user is active or inactive, allowing for the management of user access and engagement.

Request Examples

curl --request PUT \
    "https://api.r1learning.com/api/v1/companies/1/users/abcxyz123456" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: Bearer {token}" \
    --data "{
    \"username\": \"xyz123\",
    \"company_username\": \"xyz123\",
    \"client_email\": \"[email protected]\",
    \"client_location\": \"\\\"Bend Treatment Center\\\", \\\"Grants Pass Treatment Center\\\", \\\"Devon\\\", \\\"etc..\\\"\",
    \"client_program\": \"\\\"General\\\", \\\"PHP\\\", \\\"MSR\\\", \\\"etc..\\\"\",
    \"client_practitioner\": \"[email protected]\",
    \"client_status\": \"\\\"active\\\", \\\"inactive\\\"\"
}"

Response Examples

{
  "error": 0,
  "message": "User updated successfully",
  "data": {
    "username": "user123",
    "email": "[email protected]"
  }
}

Notes

  • Authorization Required: Ensure the provided Bearer token is valid and has sufficient privileges to create an admin.

  • Data Validation: All body parameters must be correctly formatted and complete. The system will validate these parameters and reject requests with missing or invalid data.

  • Uniqueness Required: The client_id, username and email must be unique within the system to prevent conflicts.

Last updated