@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.