Created
September 29, 2017 18:58
-
-
Save jeffgodwyll/daf9837ed2c791e5ddcd25c650fe9f4e to your computer and use it in GitHub Desktop.
GDG Meetup API Sample Usage
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Meetup endpoints</title> | |
<ul></ul> | |
</head> | |
<body> | |
<script> | |
let gdgList = document.querySelector('ul'); | |
const sigID = 234619972 | |
const sig = '72a93fa9dcdc63a340e336445d19bb15b27c1f29' | |
const URL = 'https://api.meetup.com/self/groups?photo-host=public&page=20&sig_id=' + sigID + '&sig=' + sig | |
const request = new Request(URL, { | |
method: 'GET', | |
mode: 'cors', | |
redirect: 'follow', | |
headers: new Headers({ | |
'Content-Type': 'application/json', | |
'Access-Control-Allow-Origin': '*', // I used an extension to force CORS, shd be set as done previously | |
}) | |
}); | |
fetch(request, { mode: 'cors' }) | |
.then((response) => { //response here was weid | |
return response.json(); | |
}) | |
.then(gdgs => { | |
for (let i = 0; i < gdgs.length; i++) { | |
let gdg = document.createElement('li'); | |
gdg.innerHTML = 'GDG Name: ' + gdgs[i].name; // not the cleanest but maybe just to show how to handle data at each node | |
gdgList.appendChild(gdg); | |
} | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment