Skip to content

Instantly share code, notes, and snippets.

@zevisert
Last active February 28, 2017 07:08
Show Gist options
  • Save zevisert/ec36d02093a55b6ded440cb8027a43d1 to your computer and use it in GitHub Desktop.
Save zevisert/ec36d02093a55b6ded440cb8027a43d1 to your computer and use it in GitHub Desktop.
Discovering Recollect's API
function test_service(place, i) {
return fetch(`https://recollect.net/api/places/${place}/services/${i}`).then(response => {
if (response.ok){
return response.json();
} else return {};
});
}
function discover_services(place) {
let existing_services = {};
for (let i = 0; i < 700; i ++ ){
test_service(place, i)
.then(data => {
if (Object.keys(data).length > 1) {
existing_services['${i}'] = data;
}
});
}
return existing_services;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment