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
Header
{
"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 token | Updates a user in | :id is |
|---|---|---|
| Platform user | Your platform organization | The unique user identifier |
| Dictation service | Your organization's corporate dictation server | The user login |
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_OWNERrole, 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
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
| Field | Required | Rules |
|---|---|---|
login | No | 1 to 254 characters. Only to rename the user |
fullName | Yes | Up to 254 characters |
email | Yes | Valid email format, up to 254 characters |
specialtyCode | Yes | Must be a code accepted by your dictation server |
organization | No | Free 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
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"
}
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",
}
errorType | errorMessage | Meaning |
|---|---|---|
invalidRequestFormat | Invalid user id | the id in the URL is not a valid user identifier |
invalidRequestFormat | Fullname is required | fullName sent empty |
invalidRequestFormat | Invalid user type | userType is not a UserType value |
invalidGroupId | Invalid group id | groupId is not a group of your organization |
unauthorizedResource | Unauthorized resource | the user does not belong to your organization |
notAllowedResource | noOrganizationOwnerError | the 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"
}
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:
| Message | Meaning |
|---|---|
Login is required | login sent empty |
Login is too long | login over 254 characters |
Fullname is required | fullName missing or empty |
The full name cannot have more than 254 characters | fullName too long |
Email is required | email missing |
Format email is invalid | email malformed |
The email cannot have more than 254 characters | email too long |
Specialty code is required | specialtyCode missing or empty |
Forbidden — dictation user
Describe the characteristics of a forbidden request
403
Response body
{
"message": "Forbidden"
}
{
"message": "Dictation server rejected the operation"
}
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"
}
{
"message": "Tenant not found"
}
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.