User avatar

Requests

HTTP verb Endpoint Description

GET

/rest/v1/user/avatar

Retrieving user avatar

PUT

/rest/v1/user/avatar

Uploading user avatar image

DELETE

/rest/v1/user/avatar

Deleting a user’s avatar image

For all requests:
Domain Type: any

Retrieving user avatar

Returns the user’s 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 the content type corresponding to the file extension.

Avatar information and image metadata are present in user info in the field 'avatar_info'.

Request

Request example
GET /rest/v1/user/avatar HTTP/1.1

Response

Example of a successful response
HTTP/1.1 200 OK

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

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

Uploading user avatar image

Allows you to upload an image file to be used as the user’s avatar.

On successful upload, meta information about the file is put into the user properties (field 'opts.avatar_info').
It’s available in /rest/v1/user/info.

Files up to 200 KB in size are allowed for uploading.

Request

Request example
PUT /rest/v1/user/avatar HTTP/1.1
Content-Type: multipart/form-data
Content-Disposition: form-data; name="asdf"; filename="image.png"

multipart content

Response

Example of a successful response
HTTP/1.1 204 No Content
Example of an unsuccessful response
HTTP/1.1 413 Request Entity Too Large

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

Deleting a user’s avatar image

Allows you to delete the image file used as the user’s avatar.

The meta-information about the file in user info is replaced by the value of 'false'.

Request

Request example
DELETE /rest/v1/user/avatar HTTP/1.1

Response

Example of a successful response
HTTP/1.1 204 No Content
Example of an unsuccessful response
HTTP/1.1 404 Not Found

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