Hi @bdallen, so yes it is possible to add an attachment to a Sales invoice via Automation (notice I didn’t use the “api” word)
The real issue is that once it’s added it not that easy to get it back again by simply requesting a pdf version of the invoice for example. (attachments are not added to pdf)
Some assumptions made and info required:
a. assumption is you have an Admin user setup for All access (e.g. adminusr:adminPassword)
b. You have HTTPS access to your ServerManager
c. My internal test site is: https://dev.miotest.local/ behind an nginX config.
Here is a basic overview on how you achieve it.
- Find the UUID of the Sales Invoice to add attachments to. (e.g. 260e4d4a-d83d-444a-a86d-4d42b569b720)
- Make file to upload available locally.
- Using Curl with the following command set works:
curl -v --user "adminusr:adminPassword" -H "Content-Type: application/octet-stream" -H "X-File-Name: MyTestFile.jpg" -H "X-File-Type: image/jpeg" --data-binary @simage.jpg "https://dev.miotest.local/new-attachment?Source=260e4d4a-d83d-444a-a86d-4d42b569b720&FileID=Tm9ydGh3aW5kQVBJ"
The response will be some JSON with the UUID of the attachment:
{"key":"362a78f3-61fa-466f-b122-612328aa27b3","view":"/view-attachment?Key=362a78f3-61fa-466f-b122-612328aa27b3&FileID=Tm9ydGh3aW5kQVBJ","delete":"/remove-attachment?Key=362a78f3-61fa-466f-b122-612328aa27b3&FileID=Tm9ydGh3aW5kQVBJ"}
To find “details” about the object, you can use the "/api/FileID/2e541a82-94d7-42fc-a388-26bdc0803455/index.json"
fixed Attachments endpoint or directly via: "/api/FileID/362a78f3-61fa-466f-b122-612328aa27b3.json"
- the object endpoint.