Create or Update an Attachment

Upload a file to an attachment field or replace an existing file with the forceUpdate option.

1 min read

Update or create an attachment.

Send the request

HTTP URL : https://<your-instance>.yooi.io/api/store/object/id/{objectId}/attachments/{attachmentFieldId}/{filename}?forceUpdate=true

HTTP method: POST

Parameters (request):

  • objectId : instance id
  • attachmentFieldId : field id
  • filename : name of the file
  • forceUpdate (optional parameter, false by default) : If a file with the same name already exists and this parameter is true, the existing file will be replaced.

Parameters (body):

file content

Header

Content-Type : file type

Run the example

curl -X POST \
  'https://<your-instance>.yooi.io/api/store/object/id/cc416276-73c4-4cb8-a090-d101422f36aa/attachments/51842f47-311c-47aa-90ea-947eb4722417/logo.jpg?forceUpdate=true' \
  -H 'Authorization: Bearer #yourtoken#' \
  -H "Content-Type: image/jpeg" \
  -d #fileContent#

Review the response

{
  "id": "cc416276-73c4-4cb8-a090-d101422f36aa",
  "key": "cc416276-73c4-4cb8-a090-d101422f36aa",
  "eventId": "1739447500951-0",
  "attachment": {
    "name": "logo.jpg",
    "revision": "0e995305-d0ea-4bca-99df-02185ef95406"
  }
}

Read more

Related articles

Was this page helpful?