Update current user’s avatar
DirectUploads
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.eyJzdWIiOiIyOTEiLCJzY3AiOiJ1c2VyIiwiYXVkIjpudWxsLCJpYXQiOjE3Mzc1NTE1NTcsImV4cCI6MTc0MDE0MzU1NywianRpIjoiOTUyN2IwNjUtN2NmMy00ZGQ3LTljYjAtYTFjN2IzY2I3Mjc0In0.qMmRXFCyi5KIiXmgqfpZChs3rwOtIZ3DnpgBHCynIYQ
Host: example.org
Cookie:
Body
{
"user": {
"attachment_type": "avatar",
"signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MTksInB1ciI6ImJsb2JfaWQifX0=--99033777a9d8431c2d3aa56bf3922c625b73b42f",
"id": 291
}
}
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: a10d8f38-7c8e-46e4-ad29-2d198a222697
x-runtime: 0.021320
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"
}
}