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

Latest commit

 

History

History
45 lines (32 loc) · 2.17 KB

File metadata and controls

45 lines (32 loc) · 2.17 KB

Set User Avatar

HTTP MethodURLRequires Auth
POST/api/v1/users.setAvataryes

{% hint style="info" %} Permission required: edit-other-user-avatar, if the setting AllowUserAvatarChange is enabled. {% endhint %}

Body Parameters

KeyExample ValueDescription
image* or avatarUrl*Any image file or a URL http://domain.tld/to/my/own/avatar.jpg

You have 2 options to set the user avatar:

  • Upload the image file to use as the new avatar, as form data.
  • Enter the image URL you want to set as the user avatar.
userId or usernameBsNr28znDkG8aeo7W or bobsmithThe ID or username of the user. If not provided, the avatar of the user who is sending the request is updated.

Example Call

With an image as form data:

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -F "image=@my-own-avatar.png" \
     http://localhost:3000/api/v1/users.setAvatar

With URL:

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type:application/json" \
     -d '{
          "avatarUrl": "http://domain.tld/to/my/own/avatar.jpg"}' \
     http://localhost:3000/api/v1/users.setAvatar

Example Response

{
    "success": true
}

Change Log

VersionDescription
0.56.0Add support for username argument.
0.48.0Set other users avatars if the callee has permission.
0.46.0Added