Users

Update current user’s avatar

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.eyJzdWIiOiIxNjIzIiwic2NwIjoidXNlciIsImF1ZCI6bnVsbCwiaWF0IjoxNzM3NTUxNTg4LCJleHAiOjE3NDAxNDM1ODgsImp0aSI6IjY4NjQwZDYxLTBlYWItNDcxZi1hMDEzLTc2MWQ2YTU3ZmU0NiJ9.b5l--pSLP-WylLGwMhkOrS2sSCpGz5wBeEdLxdNfxO4
Host: example.org
Cookie: 

Body

{
  "user": {
    "attachment_type": "avatar",
    "signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MjMsInB1ciI6ImJsb2JfaWQifX0=--2ac635d87a28cb47a962610cf0494452b74bf5a5"
  }
}

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/"efe4098489ff5828bc0bb3e904470eae"
cache-control: max-age=0, private, must-revalidate
x-request-id: 493dc626-2552-49bb-bcfe-1852dc86cd0f
x-runtime: 0.057238
content-length: 349

Body

{
  "avatar": {
    "id": 21,
    "signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MjMsInB1ciI6ImJsb2JfaWQifX0=--2ac635d87a28cb47a962610cf0494452b74bf5a5",
    "byte_size": 596,
    "filename": "test_image.png",
    "url": "http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MjMsInB1ciI6ImJsb2JfaWQifX0=--2ac635d87a28cb47a962610cf0494452b74bf5a5/test_image.png"
  }
}