DirectUploads

Update current user’s avatar

PUT update attachment

Endpoint

PUT /api/v1/direct_uploads/attachment

Parameters

Name Description Enum
user[company][attachment_type] required User company attachment type ["avatar", "logo"]
user[company][signed_id] required Signed ID of the attachment received after direct upload

Request

Route

PUT /api/v1/direct_uploads/attachment

Headers

Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyOTgiLCJzY3AiOiJ1c2VyIiwiYXVkIjpudWxsLCJpYXQiOjE3NDI0NjQ5MTIsImV4cCI6MTc0NTA1NjkxMiwianRpIjoiN2Y1NzEyYjEtNjQ3OC00MTQyLThkNmItNmVjN2EwNGY2ZThiIn0._IlWSntfBM1EpgE_IfdAC3BfqXiwA-MAW9JsNGEaziw
Host: example.org
Cookie: 

Body

{
  "user": {
    "attachment_type": "avatar",
    "signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MTksInB1ciI6ImJsb2JfaWQifX0=--99033777a9d8431c2d3aa56bf3922c625b73b42f",
    "id": 298
  }
}

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/"adfb1f30922bb44ae431a43ffa3d2a3d"
cache-control: max-age=0, private, must-revalidate
x-request-id: e40dc47b-3ec2-4706-b674-3445482a426f
x-runtime: 0.014807
content-length: 349

Body

{
  "avatar": {
    "id": 17,
    "signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MTksInB1ciI6ImJsb2JfaWQifX0=--99033777a9d8431c2d3aa56bf3922c625b73b42f",
    "byte_size": 596,
    "filename": "test_image.png",
    "url": "http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTksInB1ciI6ImJsb2JfaWQifX0=--99033777a9d8431c2d3aa56bf3922c625b73b42f/test_image.png"
  }
}