You are reading the documentation for an outdated Corteza release. 2022.9 is the latest stable Corteza release.

Working with Low Code Attachments

We omit most of the data returned by these endpoints.

We replace the important data with variables, such as $RECORD_ID.

Obtain a Signed Download URL

Obtain signed URL using attachment read or attachment list endpoints:
  • attachment read: GET $BASE_URL/compose/namespace/$NAMESPACE_ID/attachment/record/$ATTACHMENT_ID

  • attachment list: GET $BASE_URL/compose/namespace/$NAMESPACE_ID/attachment/record

Response object structure:
{
  "attachmentID": "$ATTACHMENT_ID",
  "ownerID": "$USER_ID",
  "url": "$ATTACHMENT_ORIGINAL_URL",(1)
  "previewUrl": "$ATTACHMENT_PREVIEW_URL",(2)
  "name": "$FILENAME_ORIGINAL",
  "meta": {...},
  "namespaceID": "$NAMESPACE_ID"
}
1 url contains a signed URL to the attachment.
2 previewUrl contains a signed URL to the preview version of the attachment (when available).

Example Request

curl "$BASE_URL/compose/namespace/$NAMESPACE_ID/attachment/record/$ATTACHMENT_ID" \
 -H "Authorization: Bearer $JWT";

Example Response

{
  "response": {
    "attachmentID": "$ATTACHMENT_ID",
    "ownerID": "$USER_ID",
    "url": "$ATTACHMENT_ORIGINAL_URL",
    "previewUrl": "$ATTACHMENT_PREVIEW_URL",
    "name": "$FILENAME_ORIGINAL",
    "meta": {...},
    "namespaceID": "$NAMESPACE_ID"
  }
}

Access the Attachment

Use the $ATTACHMENT_ORIGINAL_URL to access any downloadable attachment. You can either download the attachment manually, use a HTTP client (such as Axios), or display the attachment using <img src="…​" or something similar.