Images, PDF’s, and other file data can be attached to, and retrieved from, orders via the OnTime API.
Uploading File Attachments
The following endpoint and request body should be used when uploading an attachment. The Contents field must contain the file as a byte array:
REST API: POST /api/order/fileAttachment/post/{orderID}
{
"FileName": "image",
"Contents": "/9j/4AAQSkZJRgABAgEASABIAAD/4QyGRXhp ... "
}
If successful, a response code of 201 should be returned, alongside the ID, file name, and data contents of the attachment.
Downloading File Attachments
The following endpoint should be used when downloading an attachment:
REST API: GET /api/fileAttachments/{id}
The {id} portion of the above endpoint must be replaced by the attachment ID in question. This ID can be found by querying for available attachments through the following endpoint:
REST API: GET /api/fileAttachments
If successful, the contents of the file will be held within the Contents field of the response body.