HTTP Method | URL | Requires Auth |
---|---|---|
POST | /api/v1/users.setAvatar | yes |
{% hint style="info" %}
Permission required: edit-other-user-avatar
, if the setting AllowUserAvatarChange is enabled.
{% endhint %}
Key | Example Value | Description |
---|---|---|
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:
|
userId or username | BsNr28znDkG8aeo7W or bobsmith | The ID or username of the user. If not provided, the avatar of the user who is sending the request is updated. |
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
{
"success": true
}
Version | Description |
---|---|
0.56.0 | Add support for username argument. |
0.48.0 | Set other users avatars if the callee has permission. |
0.46.0 | Added |