Hello,
I am trying to export a shapefile for a featurelayer which has export enabled. everything is working manually and also from postman, but when i am trying to integrate the same in my javascript web application its giving code 498 Invalid Token. This token is generated fresh having referrer ="*" and expiry of 15days. as said its working in postman but not in my simple HTML code also.
below is a sample snippet of my code...
const formdata = new FormData();
formdata.append("itemId", "33cfb3f2849e4793b6551512e0eddac8");
formdata.append("exportFormat", "Shapefile");
formdata.append("token", "MyTOKEN");
formdata.append("exportParameters", "{\n \"layers\" :[ {\"id\" : 0,\"where\" : \"ward_name = 'Bagahada'\"}]\n}");
formdata.append("f", "json");
formdata.append("title", "testshp4");
const requestOptions = {
method: "POST",
body: formdata,
redirect: "follow"
};
fetch("https://myportal/portal/sharing/rest/content/users/portaladmin/export", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));