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.eyJzdWIiOiIxNjU0Iiwic2NwIjoidXNlciIsImF1ZCI6bnVsbCwiaWF0IjoxNzQyNDY0OTQ4LCJleHAiOjE3NDUwNTY5NDgsImp0aSI6IjgyYTE1NzM3LTdjMWUtNGQwYi05ZGUyLWZmYzIwODMxM2M4MiJ9.REmrSTTi8yuTStq8d_kpDKL1cdy1WKybBft4zeVxlyg
Host: example.org
Cookie:
Body
{
"user": {
"attachment_type": "avatar",
"signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MjYsInB1ciI6ImJsb2JfaWQifX0=--b53e18eb318301cf07ba6ef3bfc889a270590fdf"
}
}
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/"7816a67a5fc3d07169e1a1d150fd530a"
cache-control: max-age=0, private, must-revalidate
x-request-id: 831500a9-1630-4ec7-a347-a2be7656f6a8
x-runtime: 0.068273
content-length: 349
Body
{
"avatar": {
"id": 22,
"signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MjYsInB1ciI6ImJsb2JfaWQifX0=--b53e18eb318301cf07ba6ef3bfc889a270590fdf",
"byte_size": 596,
"filename": "test_image.png",
"url": "http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MjYsInB1ciI6ImJsb2JfaWQifX0=--b53e18eb318301cf07ba6ef3bfc889a270590fdf/test_image.png"
}
}