User avatar

Requests

HTTP verb Endpoint Description

GET

/rest/v1/iam/users/<id>/avatar

Getting the user avatar

PUT

/rest/v1/iam/users/<id>/avatar

Uploading the user avatar image

DELETE

/rest/v1/iam/users/<id>/avatar

Deleting the user avatar image

For all requests:
Domain type: any

Getting the user avatar

Returns the user avatar image.

If the '&attachment=true' parameter is added to the request URL, the file is downloaded as an attachment. Otherwise the file is returned with a content type corresponding to the file extension.

Information about avatar presence and image metadata is present in the user account in the 'opts.avatar_info' field.
It is available in the API /rest/v1/iam/users.

Request

Example request
GET /rest/v1/iam/users/7b2130e5-3302-a826-104c-1a8273b2093f/avatar HTTP/1.1

Response

Example successful response
HTTP/1.1 200 OK

binary content of avatar
Example failed response
HTTP/1.1 404 Not Found

{
  "error_code": 1404,
  "error_message": "Avatar not found"
}

Uploading the user avatar image

Allows uploading an image file used as the user avatar.

On successful upload, file metadata is set in the user account (the 'opts.avatar_info' field).

Files up to 200 KB are allowed for upload.

Request

Example request
PUT /rest/v1/iam/users/7b2130e5-3302-a826-104c-1a8273b2093f/avatar HTTP/1.1
Content-Type: multipart/form-data
Content-Disposition: form-data; name="asdf"; filename="image.png"

multipart content

Response

Example successful response
HTTP/1.1 204 No Content
Example failed response
HTTP/1.1 413 Request Entity Too Large

{
  "error_code": 1506,
  "error_message":"upload exceeds maximum size of 204800"
}

Deleting the user avatar image

Allows deleting the image file used as the user avatar.

File metadata in the user account is replaced with the value 'false'.

Request

Example request
DELETE /rest/v1/iam/users/7b2130e5-3302-a826-104c-1a8273b2093f/avatar HTTP/1.1

Response

Example successful response
HTTP/1.1 204 No Content
Example failed response
HTTP/1.1 404 Not Found

{
  "error_code": 1404,
  "error_message": "Avatar not found"
}