Hi All,
In Addition to my topic with Acumatica REST API where I showed how to retrieve and save records using Acumatica Contract Base Rest API I want to share with you now how can you attach files with the same way.
To Attach file you just need to put binary data by following URL:
https://<server>/entity/<endpoint>/<version>/<entity>/<key1>/<key2>/files/<filename>
For example, to attach file to stock item you will have following URL:
http://acusea.acumatica.com/entity/Default/6.00.001/StockItem/AACOMPUT01/files/image.png
File will be attached to entity automatically.
Have a nice integration!
Is it possible to base64 encode a file to upload instead of using the binary?
Hi Sergey,
I’m trying to attach file to SalesOrder Item (customize file for Item) in Details, but no luck.
Could you help me on this? (attach file for Order-Item, not for the order as Sai mention above).
Thank you
I’m not sure if that is possible to add file to line using rest API… Try to create a support case, may be our dev support team can give you a better workaround.
Can I put multiple file with one send only.
Thank you
Hi Vicktor, nope, here should be file by file.
Can I put multiple file in one send?
With the file upload i want to specify a comment that should appear in the column “Comment”.
How can I achieve this?
I think you cannot do this in one call. You need to upload file first, than do second call with to File Maintenance screen to put comment there.
I think File Maintenance screen may not be mapped in the Endpoint by default.
Hi Sergey,
I have a issue in attaching a pdf file to a Purchase order Screen.
I am getting error like this –
“message”: “An error has occurred.”,
“exceptionMessage”: “Operation is not valid due to the current state of the object.”,
“exceptionType”: “System.InvalidOperationException”,
I have used put method
PUT: localhost/AcumaticaXMSI/entity/Default/18.200.001/PurchaseOrder/PO000942/files/refNbr3.pdf
Is there anything Wrong with this?
I can attach file succesfully in StockItem by following your procedure, but unable to attach files in Purchase Order screen
I think its due to key field what we are using, what is the Key field in Purchase Order?
The answer to my question found is –
I have specified OrderNbr (PO000942) but not OrderType and also sequence is also matters. first OrderType and then OrderNbr.
Like this……
PUT: localhost/AcumaticaXMSI/entity/Default/18.200.001/PurchaseOrder/RO/PO000942/files/refNbr3.pdf
Hi Sergey,
Do you know if it is possible to add version of the file when attaching file with REST api?
Do you mean you want to get the specific version or just add a version when yoг put it there?
I guess you can add some text with version into the name
It’s very useful your post.
I’m trying to attach files to Sales Invoice. Is it possible to attach files with REST API where de document is in Closed status?
I’m getting this error:
“message”: “An error has occurred.”,
“exceptionMessage”: “Error: The Save button is disabled.”
I did it manually in Acumatica and I can upload the file even if the document is closed. But I have no success with REST
Hi Anahi,
I saw this error before, and even have seen a bug for that. Could you please advise what version of Acumatica do you use? I think it should work correctly in 218R2. In case not, please create a support case as we need to escalate to developers.
I’m using Acumatica 2017 R2
Hi Anahi,
I recommend you to create a support case, as file attaching should be consistent in UI and API.