Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
using free national API to get data, "blocked by CORS policy" but works with postman/regular url

I am trying to get books list from National Library API (free for public use). It gives back JSON when visiting the URL in Chrome or hitting the endpoint with Postman. However, I can't get rid of the error when trying to make it through localhost, while developing. when I add: { mode: "no-cors"} to the fetch options, I get a response back, but opaque type, so I can't read the data.

fetch(
  `https://api.nli.org.il/openlibrary/search?api_key=uoX9ZMiaRMIBUF4pX0SEuGXMRpUqQIHrw5XuQKcE&query=title,exact,,AND;language,exact,heb&output_format=json&material_type=books`,
  {
    method: "GET",
    headers: {
      "Access-Control-Allow-Origin": "*",
    },
  }
).then((response) => console.log(response));

Error in console:

Access to fetch at 'https://api.nli.org.il/openlibrary/search?api_key=uoX9ZMiaRMIBUF4pX0SEuGXMRpUqQIHrw5XuQKcE&query=title,exact,%D7%97%D7%A0%D7%95%D7%9A,AND;language,exact,heb&output_format=json&material_type=books' 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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!