Last active
February 28, 2017 07:08
-
-
Save zevisert/ec36d02093a55b6ded440cb8027a43d1 to your computer and use it in GitHub Desktop.
Discovering Recollect's API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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