0

I have a site, which uses where2GetIt API. I need to get some data from this site,

but after making request, I get "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access" error.

I assume, that the problem is, that I have not access to API. How can I get the access to API?

Andy
  • 1
  • 1
  • 1
    Possible duplicate of [How does Access-Control-Allow-Origin header work?](http://stackoverflow.com/questions/10636611/how-does-access-control-allow-origin-header-work) – Paul Dixon Dec 13 '15 at 09:52

1 Answers1

0

If you're doing this with Javascript, make sure you understand CORS

...CORS gives web servers cross-domain access controls, which enable secure cross-domain data transfers. Modern browsers use CORS in an API container - such as XMLHttpRequest - to mitigate risks of cross-origin HTTP requests.

See also this StackOverflow question How does Access-Control-Allow-Origin header work?

Community
  • 1
  • 1
Paul Dixon
  • 295,876
  • 54
  • 310
  • 348
  • Thansk for answering. The porblem is, that I don't understand, what format of output I will get, requesting restricted API. It will be some kind of token, for the first time, or something else? – Andy Dec 13 '15 at 09:57
  • If the API provider doesn't support CORS, then using the API from Javascript may only be possible with JSONP techniques. Other technique is to "proxy" the API through the same domain your app resides on. – Paul Dixon Dec 13 '15 at 10:06
  • Thank you, now I have something, to think about :) – Andy Dec 13 '15 at 10:18