media/persons/{uid}/picture

Returns the picture a person has set, or no content when there is no picture to show. Use it to draw a person's avatar: show the picture when one comes back, otherwise draw your own placeholder, such as the person's initials.

Any user can get their own picture. To get another person's picture, the calling user needs the right Can view user names. Without it, the method returns 204 for every other person, exactly as for a person without a picture, so the answer never shows whether that person has a picture.

Each call counts toward the user's and the platform's API usage limits, like other methods, 304 answers included. Keep the pictures you receive rather than asking again for the same person.

URL

(GET) /api/media/persons/{uid}/picture

PARAMETERS

Name

Description

Type

uid

The person's user ID, as returned by persons/list. Zero or a negative value returns 204.

int, mandatory

No request body.

RESULTS

Status

Response

200

The person's picture, as a PNG thumbnail 64 pixels wide. Sent with Last-Modified and Cache-Control: must-revalidate. The Content-Type header is application/jpg, as on the other person picture methods.

304

Nothing has changed since the date in If-Modified-Since: keep using your copy.

204

No picture to show: the person has not set one, no person has this ID, uid is zero or negative, or the calling user may not see this person. Empty body and Cache-Control: no-cache, identical in every one of these cases.

A picture removed since your last call returns 204, also when you send If-Modified-Since.

A 204 is not always final: it is also returned when the person's settings cannot be read at that moment, for example during a database outage. Do not store it as a permanent "no picture".

Bash
curl -i -H "X-Auth-Token: <token>" -H "X-Auth-AccountId: <account>" \
  "https://<platform>/api/media/persons/<uid>/picture"

ERRORS

Errors use the standard API error response.

Status

Condition / message

401

Not authenticated.

400

The stored picture cannot be read, for example because its data is damaged or the file is locked.

429

The user's or the platform's API usage limit is reached.

SEE ALSO