Skip to content

Instantly share code, notes, and snippets.

@Abbe98
Created October 28, 2018 11:54
Show Gist options
  • Save Abbe98/19a06618a042d1c7f41a574d8a3e6e0c to your computer and use it in GitHub Desktop.
Save Abbe98/19a06618a042d1c7f41a574d8a3e6e0c to your computer and use it in GitHub Desktop.
const fetchJson = async (url) => await (await fetch(url, { headers: new Headers({ 'Accept': 'application/json' }) })).json();
const sochQuery = async (query) => {
const json = await fetchJson(`http://www.kulturarvsdata.se/ksamsok/api?x-api=test&method=search&query=geoDataExists=n%20AND%20thumbnailExists=j%20AND%20itemType=foto&recordSchema=xml&fields=itemDescription,itemLabel,thumbnail,byline,copyright,mediaLicense&startRecord=10000`);
return json.result.records.record.map(r => r['field']);
}
console.log(sochQuery(''))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment