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.eyJzdWIiOiIxNjY0Iiwic2NwIjoidXNlciIsImF1ZCI6bnVsbCwiaWF0IjoxNzYwOTUwNDczLCJleHAiOjE3NjM1NDI0NzMsImp0aSI6IjQyNGEzMDcwLTM5ODAtNDcwYS1hMTQ3LTNiNTk1OGMxZDY2YSJ9.JAHy1MDS_1yDnIrhlDXu1aB_Ro3DZIOJ0GJBovHONyY
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: 667ba6e0-51e9-414e-8000-d9db40a150c0
x-runtime: 0.066202
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"
}
}