Actions
Question #1211
closedAPI: CORS handler
Start date:
2020-04-22
Estimated time:
Description
Update: For handling Cross Origin Resource Sharing (CORS) and making cross-origin AJAX possible flask-cors was implemented: https://flask-cors.readthedocs.io/en/latest/.
Original descriptionHi everyone!
For getting data into the thanados app I was trying to figure out how to access the API (from thanados.openatlas.eu) via javascript (from my localhost).
- 1st I set the API to public
- 2nd I tried to get one Json ld via jquery's getjson:
$.getJSON( "https://thanados.openatlas.eu/api/0.1/entity/120290", function( data ) { console.log(data) });
i get the following error:
Access to XMLHttpRequest at 'https://thanados.openatlas.eu/api/0.1/entity/120290' from origin 'http://127.0.0.1:5000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
If I execute the command from the console on the thanados.openatlas.eu website, it works.
I tried some suggestions from stackoverflow etc. but none did work to get the data from my localhost.
I wonder if the error is on my end or if we need to allow requests from other origins than thanados.openatlas.eu in the openatlas code.
Any help appreciated.
Thanks and best regards,
Stefan
Actions