Skip to main content
Skip table of contents

Retrieve Attachments for a sales transaction

Retrieve webhook data

To be able to download the attachments that were added to a sales transaction, you must first receive the webhook. The webhook receiver can be configured in the Store Management Portal under the Webhooks section.

You need the correct privileges to be able to access the Webhooks section in the Store Management Portal.

When configured correctly, you should be able to retrieve the data which is send by Retail by Aiden POS application. An example of the JSON file is displayed below (file is shortened for viewing purposes).

JSON
{
  "transactionCode": "20240603-Q739-0EDP",
  "transactionDate": "2024-06-03T13:33:26.564Z",
  "transactionType": "Sales",
  "status": "Finished",
  
  ...
  (Data removed on purpose)
  ...
  
  "comments": "",
  "attachmentsId": "{attachmentsId}",
  "openDocuments": []
}

Near the bottom of the JSON you’ll find a field called attachmentsId. This field contains a link to a private folder on the POS storage bucket.

You can use this id to retrieve its contents.

Retrieve download URL’s

To be able to retrieve a download you’ll need the attachmentsId, as specified above, and you’ll need to have a valid Integration Token to verify that you are authorized to do so. Integration Tokens can also be configured in the Store Management Portal under the Reference Keys section.

You need the correct privileges to be able to access the Reference Keys section in the Store Management Portal.

When you have a valid Integration Token, you can use it as a bearer token in the Authorization Header when calling the Integration Attachments Service API.

POWERSHELL
GET https://apim-aiden-ip-prod-001.azure-api.net/prod/IntegrationAttachments/Attachments-Integration/FileList/{attachmentsId}

If configured correctly, you should receive (expiring) download URL’s for each attachment in the referenced attachmentsId.

The response should look like this (some data was removed to make the example more readable):

JSON
content-type: application/json; charset=utf-8
date: Mon, 03 Jun 2024 13:33:51 GMT
strict-transport-security: max-age=31536000; includeSubDomains
transfer-encoding: chunked

[{
    "name": "240409_AttachmentExample.pdf",
    "url": "{Download URL}",
    "contentType": "application/pdf",
    "size": 822256
}, {
    "name": "Example_IMG_20150527_181132.jpg",
    "url": "{Download URL}",
    "contentType": "image/jpeg",
    "size": 326327
}]

Keep in mind that the URL’s expire. When expired it is possible to generate new URL’s by using the function above with the same attachmentsId.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.