Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Latest commit

 

History

History
30 lines (19 loc) · 2.63 KB

File metadata and controls

30 lines (19 loc) · 2.63 KB

Get Avatars

Avatars are fetched from the server for each room and user, giving the client control over the size and format of the returned image.

HTTP MethodURLRequires Auth
GET/avatar/{subject}no

Path Variables

KeyExample ValueDescription
subject*alice, @general

Name of the user or channel.

Channels are always preceded by an @ symbol. Rooms that are DMs are always represented by the other participant's user avatar.

Query Parameters

The following query parameters are optional.

KeyExample ValueDescription
formatpng

Format of the image requested.

The values can be one of: jpg, jpeg, png.

size50Width and height of the image. Default: 200
rc_uidaobEdbYhXfu5hkeqGUser ID for authenticating is only required if Accounts_AvatarBlockUnauthenticatedAccess is enabled.
rc_token9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSqUser auth token for authenticating is only required if Accounts_AvatarBlockUnauthenticatedAccess is enabled.

Example Call

curl http://localhost:3000/avatar/alice?size=50

Notes

  • This is a RESTful endpoint that sits separately from the REST API in the server codebase and behaves slightly differently.
  • The rc_uid and rc_token can alternately be provided as cookies (already present in the web interface), but not as auth headers.
  • When requesting the avatar of a user, if they have a custom avatar set, this will override the user's choices of format or size.
  • If no uploaded avatar exists for a user, a default one will be generated for them based on the initial of their username in a randomly colored square.
    • If UI_Use_Name_Avatar is set AND the user has a real name set; the generated avatar will be based on their actual name instead of the username.
  • If no format is requested, or the format requested isn't supported, the format returned will be SVG.