Hi guys
I already wrote @benjamin about this, but I decided to write in here, as maybe someone else had the same problem and already solved it.
I am currently trying to build a remote control for Syrinscape, that I can integrate into foundryvtt (https://foundryvtt.com/), therefore I am trying to access the API with javascript.
While I can get the play and stop functions to run without problems, I cannot read from the API remotely.
Here is my basic fetch command (replace AUTH with the Auth token)
fetch(“https://www.syrinscape.com/online/frontend-api/soundsets/29/?format=json&auth_token=”+AUTH)
.then((response) => {
return response.json();
})
.then((data) => {
console.log(data);
});
generates an error:
“Access to fetch at 'https://www.syrinscape.com/online/frontend-api/soundsets/29/?format=json&auth_token=AUTH from origin ‘http://127.0.0.1:5500’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.”
when I now set the mode to no-cors, i only get the opaque response with no data in it.
Can anyone point me the right way, so I can access the API from a 3rd party script?
Thanks in advance.