0

I'm trying to make a HTTP GET request with Wikipedia's API with D3.

I'm using http-server to make the request locally. I've used D3 in the past to make HTTP GET requests over an HTTP URL (http://googleapi.com) but am getting an error with this HTTPS.

API request in D3

// make API request to wiki
var wiki_api = "https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=" + node.name;

// get the data
d3.json(wiki_api, function(error, wiki) {
  console.log(wiki);
});

I'm getting the following error:

XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=Blues. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8008' is therefore not allowed access.

How can I make HTTPS requests?

Community
  • 1
  • 1
Kyle
  • 1,153
  • 5
  • 28
  • 56

0 Answers0