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.eyJzdWIiOiIyOTgiLCJzY3AiOiJ1c2VyIiwiYXVkIjpudWxsLCJpYXQiOjE3NDg1MTY1MDAsImV4cCI6MTc1MTEwODUwMCwianRpIjoiM2RmMWMwMzItMTE0OS00YmM4LWI4MDYtNTFhNTA0YzFhYTIxIn0.wW_0fgdsIXnPtSUEjW1aSeudVtIoEizmEEcBReJU-Rg
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: 565bb462-57b4-474e-97fb-8006257206c1
x-runtime: 0.011307
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"
}
}