Edit user


Request description

Endpoint: /users/:id/update
Method: PATCH

The following parameter must be passed through the URL:

  • id: specifies the unique user identifier
{
  "Content-Type": "application/json",
  "Authorization": "Bearer <accessToken>"
}

Note: the <accessToken> is obtained as a result of the authentication. The authentication flow you have to follow depends on the access mode, see Access modes.

Access modes

This endpoint accepts two kinds of access token. The meaning of :id and the request body depend on which one you use:

Access tokenUpdates a user in:id is
Platform userYour platform organizationThe unique user identifier
Dictation serviceYour organization's corporate dictation serverThe user login
How to get the dictation service token: the dictation path does not use the token returned by User login. Its access token is generated exactly the same way as the AI Services access tokens: with your APP Id and API Key encoded in base64 (appId:apiKey) and sent as Basic <token> to the /api/v1/token endpoint. See AI Services — Credentials for the full procedure and code examples.

Platform user

Payload

{
  "fullName": "mock-full-name",
  "groupId": "group-id",
  "userType": "REGULAR"
}

Payload structure

type EditUserPayloadType = {
  fullName?: string;   // Not empty when sent
  groupId?: string;    // Id of an existing group of your organization
  userType?: UserType; // User role in the organization
};

type UserType = "ORGANIZATION_OWNER" | "ORGANIZATION_ADMIN" | "REGULAR";

All fields are optional. Only the fields you send are updated. A request with an empty body {} is accepted and does not change the user.

Role rules:

  • Only an Organization Owner can assign the ORGANIZATION_OWNER role, or change the role of a user who is an Organization Owner.
  • An organization must always keep at least one Organization Owner.

Dictation user

Updates a user of the corporate dictation server of the organization associated with your credentials.

Payload

{
  "login": "jperez2",
  "fullName": "Juan Perez Gomez",
  "email": "jperez@hospital.com",
  "specialtyCode": "1",
  "organization": "Hospital X"
}

Payload structure

type EditDictationUserPayloadType = {
  login?: string; // Only to rename the user. Defaults to the login in the URL
  fullName: string; // Required
  email: string; // Required
  specialtyCode: string; // Required
  organization?: string; // Free-text organization label
};

Partial updates are not supported

The dictation server overwrites the user with whatever it receives, so fullName, email and specialtyCode are mandatory on every request. Sending only the field you want to change would clear the rest. Always send the complete set of values, including the ones that stay the same.

Renaming a user

Send the current login in the URL and the new one in the login field of the body. If login is omitted, the user keeps its current login.

Field rules

FieldRequiredRules
loginNo1 to 254 characters. Only to rename the user
fullNameYesUp to 254 characters
emailYesValid email format, up to 254 characters
specialtyCodeYesMust be a code accepted by your dictation server
organizationNoFree text. Defaults to empty

See Invite user for details about specialtyCode.

The license type of the user is managed by the platform and is not affected by this request. Any additional field sent in the payload is ignored.

Known limitation

The dictation server does not currently apply changes to email. The field is still mandatory and must be sent, but its value is ignored. Every other field is updated as expected.

Responses

Correct response

Successful request — platform user

Describe the characteristics of a satisfactory response

200

Response structure:

{
  "message": "User updated successfully"
}


Successful request — dictation user

Describe the characteristics of a satisfactory response

200

Response structure:

{
  "message": "User updated successfully",
  "login": "jperez2"
}
Description: login is the login the user has after the update, which is useful when the user has been renamed.

Wrong responses

Unauthorized request

Describe the characteristics of an unauthorized request

401

Response body

{
  "message": "Unauthorized"
}

Description: this error occurs when endpoint authorizers fail to validate the token sent in the request header.


Not found — platform user

Describe the characteristics of a not found request

404

Response body

{
  "errorType": "InvalidParameters",
  "errorMessage": "User not found",
  "message": "User not found",
  "details": [
    /* validation detail */
  ]
}

Description: there is no user with the identifier sent in the URL.


Bad request — platform user

Describe the characteristics of a bad request

400

Response body

type EditUserResponseType = {
  errorType: Edit_USER_ERROR_TYPE;
  errorMessage: string;
  message?: string;    // Present on validation errors
  details?: object[];  // Present on validation errors
};

enum Edit_USER_ERROR_TYPE {
  INVALID_REQUEST_FORMAT = "invalidRequestFormat",
  INVALID_GROUP_ID = "invalidGroupId",
  UNAUTHORIZED_RESOURCE = "unauthorizedResource",
  NOT_ALLOWED_RESOURCE = "notAllowedResource",
}
Description:
errorTypeerrorMessageMeaning
invalidRequestFormatInvalid user idthe id in the URL is not a valid user identifier
invalidRequestFormatFullname is requiredfullName sent empty
invalidRequestFormatInvalid user typeuserType is not a UserType value
invalidGroupIdInvalid group idgroupId is not a group of your organization
unauthorizedResourceUnauthorized resourcethe user does not belong to your organization
notAllowedResourcenoOrganizationOwnerErrorthe change would leave the organization without an Owner


Forbidden — platform user

Describe the characteristics of a forbidden request

403

Response body

{
  "errorType": "notAllowedResource",
  "errorMessage": "Unauthorized",
  "message": "Unauthorized"
}
Description: an Organization Admin tried to assign the ORGANIZATION_OWNER role or to change the role of an Organization Owner.


Bad request — dictation user

Describe the characteristics of a bad request

400

Response body

{
  "errorType": "invalidRequestFormat",
  "errorMessage": "Specialty code is required",
  "message": "Specialty code is required",
  "details": [
    /* validation detail */
  ]
}

Description: errorMessage identifies the first field that failed. Possible values:

MessageMeaning
Login is requiredlogin sent empty
Login is too longlogin over 254 characters
Fullname is requiredfullName missing or empty
The full name cannot have more than 254 charactersfullName too long
Email is requiredemail missing
Format email is invalidemail malformed
The email cannot have more than 254 charactersemail too long
Specialty code is requiredspecialtyCode missing or empty

Forbidden — dictation user

Describe the characteristics of a forbidden request

403

Response body

{
  "message": "Forbidden"
}
Description: your credentials are not allowed to manage dictation users.Response body
{
  "message": "Dictation server rejected the operation"
}
Description: the dictation server refused the request.


Not found — dictation user

Describe the characteristics of a not found request

404

Response body

{
  "message": "There is no user with that login in the dictation server"
}
Description: the login sent in the URL does not exist.Response body
{
  "message": "Tenant not found"
}
Description: there is no dictation server for your organization in this environment.


Dictation server unavailable

Describe the characteristics of an unreachable dictation server

502

Response body

{
  "message": "Dictation server unavailable"
}

Description: the dictation server could not complete the request. Also returned when the speciality code is not valid.


Dictation server timeout

Describe the characteristics of a dictation server that does not answer in time

504

Response body

{
  "message": "Dictation server did not respond in time"
}

Description: the dictation server did not answer within the allowed time.