Creating attachments using REST

We have an app that our warehouse team use to take pictures and attach them to packs / jobs / sales orders. It’s actually a web app developed in house and outputs the image and CSV file to a folder where a PowerShell Script uses DMT to import / create the attachment record. Whilst this works quite well it occurs to me that, as this is a web based app, it may be better to use a REST call to insert the attachments.

I am a total newbie to REST, I just about get that it talks to EPICOR via “web calls” but it seems like it may be a better approach.

To that end, has anyone used the REST API to add attachments? Does anyone got any examples of how it works? I got as far as finding the API Call, but I have no idea what to put into the Inputs.

Many thanks for any help / guidance :smiley:

Are you trying to link to a file source (eg. file on a network share somewhere) or upload into the database? Also, are you cloud or local?

Use the Trace Luke.

1 Like

Always my first port of call, but it doesn’t seem obvious to me how to correlate the trace log inputs to the example REST Inputs?

You need to switch to custom method list in the REST help, see the link in top right corner.

Basically you upload file using that UploadFile method, then you can use POST /Attachements to add /update record in XFileAttach/XFileRef tables, where reference to the uploaded file is stored.