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.eyJzdWIiOiIzMDgiLCJzY3AiOiJ1c2VyIiwiYXVkIjpudWxsLCJpYXQiOjE3NjMwMjIxODksImV4cCI6MTc2NTYxNDE4OSwianRpIjoiNmY5NGRjY2ItYmFiZi00YjUzLWI5OTYtMWM4ZmEzNGU4MzEzIn0.UHxVAkXBDxZopDQ2ZHbIxe_COXPbuEn-8G9jaGhkIAQ
Host: example.org
Cookie:
Body
{
"user": {
"attachment_type": "avatar",
"signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MTksInB1ciI6ImJsb2JfaWQifX0=--99033777a9d8431c2d3aa56bf3922c625b73b42f",
"id": 308
}
}
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: 7dff7771-ea49-4ab2-899d-044e0b30f861
x-runtime: 0.016782
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"
}
}