Skip to content

Instantly share code, notes, and snippets.

@jeffgodwyll
Created September 29, 2017 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffgodwyll/daf9837ed2c791e5ddcd25c650fe9f4e to your computer and use it in GitHub Desktop.
Save jeffgodwyll/daf9837ed2c791e5ddcd25c650fe9f4e to your computer and use it in GitHub Desktop.
GDG Meetup API Sample Usage
<!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