@brandtley - do you have an example for DocStarDownloadFile?
@daveleland, sorry had to dig around, but I found it.
Take my notes from the snippet before about ‘epicorUrl’ and ‘authentication’.
function downloadAttachment() {
console.log("contentObject2: ", contentObject2);
let epicorUrl = '';
let authentication = '';
let url = '/v1/Ice.BO.AttachmentSvc/DocStarDownloadFile';
var val = contentObject2.value[0];
var refNum = val.XFileRefNum;
var xRefNum = parseInt(refNum);
//const response2 = JSON.parse(contentObject2);
return (async () => {
const rawResponse3 = await fetch(epicorUrl + url, {
method: 'POST',
headers: {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": authuentication
},
body: JSON.stringify({
xFileRefNum: xRefNum,
metadata: {
}
})
});
const content3 = await rawResponse3.json();
//console.log(content3);
contentObject3 = content3;
})();
};
I think it gives you a base64 string, and you’ll have to convert it to whatever file format it should be.
@daveleland, sorry it isn’t in C#. I’m not really good at anything, but I am much more familiar with JavaScript than C#. Maybe @josecgomez would bless us with his wisdom.
Update: check this out, Epicor Rest Helper (Nuget) Updated V2, there may be some helpful information in here.
1 Like
Here’s the REST Call to do that
//Setup the Epicor REST API as outlined in the Epicor Rest Helper Nuget Documentation
var addedDocStarFile = EpicorRest.DynamicPost("Ice.BO.AttachmentSvc", "DocStarDownloadFile", new { xFileRefNum = 2222 });
//Where 2222 is the XFileRef number of the attachment
The response looks like this
{
"returnObj": "string",
"parameters": {
"metadata": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
},
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
Where returnObj is a Base64 encoded file.
3 Likes