How can I download part attachments from ECM

I am new to Epicor APIs, and have been trying to knock together some scripts to mimic some automation we had with our previous ERP system.

In Kinetic, we have drawings attached to most every part. I can find a decent bit of information about the attachments in the “PartAttaches” section of a “/{currentCompany}/Erp.BO.PartSvc/Parts” request. However, I can’t seem to figure out how to use this to download a document from ECM. I was hoping to be able to use the “FileName” or “SysRowID” records to make a call to ECM, but I can’t seem to find much information on this at all. Wondering if I’m just going about this all wrong.

I’d appreciate any input.

When you integrate ECM with Epicor via the Attachment Type Maintenance program, the associated Document Types you setup to use that ECM attachment type should automatically transfer to ECM and be stored there. Then, when accessing the attachment in Epicor via the paperclip icon, there will be options to view, download or open in ECM, depending on your version of Epicor.

If the documents are not already stored in ECM, there is no way to pull them from there because they do not exist. Perhaps I am missing something in how you have things setup, though…

Ah, sorry, I don’t think I was clear on that – I am looking for a programmatic way to download these. I’ve got a script running locally on my PC and making API calls to find the parts I need – I am hoping to make similar API calls to download attached files and process them further.

You want to use the AttachmentSvc method DocStarDownloadFile.

If you search the site for DocStarDown or DocStarUp you will find info on uploading and downloading ECM documents.

1 Like

Ah, got it – for some reason I was missing that when I was searching the REST API Help menu. However, I am still a little lost on what parameters it’s expecting. There is a metadata field as part of the POST request that I don’t understand.

If I use the DownloadFile method, it only asks for a xFileRefNum field, but returns a 400 - Bad Request that tells me the file path is invalid (although it does appear to be selecting the right file)

If I use the DocStarDownloadFile method, I get a 500 internal server error, I think because I’m not setting the metadata field(s) correctly in the request body.

send empty object for metadata

3 Likes

WIth APM, you can take and receive documents from DocStar.

An APM is one option or could use a workflow to send an email with the document attachment, use gearmage or power automate to export the pdf to a file location.