How to use the wikidata-sdk/dist/wikidata-sdk.js.getEntities function in wikidata-sdk

To help you get started, we’ve selected a few wikidata-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benjamintd / benmaps.fr / src / middlewares / apiCaller.js View on Github external
function getWikidataPlaceInfo(action, next) {
  const id = action.feature.properties.wikidata;
  const url = wdk.getEntities({
    ids: id,
    languages: ["en"]
  });

  fetch(url, { method: "get" })
    .then(res => {
      if (res.ok) {
        return res.json();
      } else {
        // 4xx or 5xx response
        var err = new Error(res.statusText);
        return Promise.reject(err);
      }
    })
    .then(data => {
      // Success