Accessing CSV from File Manager to parse using Javascript returns 401

Hi,

I am trying to use JavaScript to parse a csv file that is uploaded in a form and gets stored at an address similar to: https://api.fliplet.com/v1/media/files/*******/contents/*****.csv

I am using Papa Parse since it is a Fliplet approved library to do this by setting a variable called ‘csvUrl’ to the above URL and passing it as follows:

Papa.parse(csvUrl, {
download: true,
complete: function(results) {
}
});

I get a 401 response when doing this. If I enter the same URL into a browser tab the file downloads just fine, it seems to be only when accessing programmatically. I can’t see anywhere to set any permissions to resolve this.

Can someone tell me what the missing piece to this is please.

Thanks

Andy

Hi Andy,

It is likely you need to authenticate the file before passing it to Papa Parse. See instructions here: Media JS APIs | Fliplet Developers Documentation

All files stored in Fliplet need to be authenticated to be used outside Fliplet Studio including in JS.

Thanks,
Deb

Great thanks Deb