Update current user’s avatar
Users
PUT update avatar
Endpoint
PUT /api/v1/users/attachment
Parameters
Name | Description | Enum |
---|---|---|
user[attachment_type] required | User attachment type | ["avatar"] |
user[signed_id] required | Signed ID of the attachment received after direct upload |
Request
Route
PUT /api/v1/users/attachment
Headers
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNjg1Iiwic2NwIjoidXNlciIsImF1ZCI6bnVsbCwiaWF0IjoxNzUzMjY2MjIyLCJleHAiOjE3NTU4NTgyMjIsImp0aSI6Ijk1NGY1ZGI4LTZkNzAtNDAxNi1iZWUzLTJiOTk3ZTA5MDAzNCJ9.uiz4IVDzCsmuRq4S-eb8ow4fqVydHfqVX5NsmaK6tjc
Host: example.org
Cookie:
Body
{
"user": {
"attachment_type": "avatar",
"signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MjYsInB1ciI6ImJsb2JfaWQifX0=--88a9a0538046ab6404446833c4bbf59c47af49d6"
}
}
Response
Simulated Response
Status
200
Headers
x-frame-options: SAMEORIGIN
x-xss-protection: 0
x-content-type-options: nosniff
x-permitted-cross-domain-policies: none
referrer-policy: strict-origin-when-cross-origin
content-type: application/json; charset=utf-8
vary: Accept, Origin
etag: W/"f8879e42eec60653afaffe17efee677c"
cache-control: max-age=0, private, must-revalidate
x-request-id: e008ba7b-6783-4b6c-8312-15f481ce7d8b
x-runtime: 0.037626
content-length: 349
Body
{
"avatar": {
"id": 22,
"signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MjYsInB1ciI6ImJsb2JfaWQifX0=--88a9a0538046ab6404446833c4bbf59c47af49d6",
"byte_size": 596,
"filename": "test_image.png",
"url": "http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MjYsInB1ciI6ImJsb2JfaWQifX0=--88a9a0538046ab6404446833c4bbf59c47af49d6/test_image.png"
}
}