Skip to content

Instantly share code, notes, and snippets.

@sjwaight
Created March 29, 2022 23:29
Show Gist options
  • Save sjwaight/ec28fc08da1f7d2ff3a4abdbfdeab5e0 to your computer and use it in GitHub Desktop.
Save sjwaight/ec28fc08da1f7d2ff3a4abdbfdeab5e0 to your computer and use it in GitHub Desktop.
Bash script showing how to invoke a GraphQL API using curl.
# Originally from: https://www.meetup.com/api/guide/#p02-querying-section
query='query($eventId: ID) {
event(id: $eventId) {
title
description
dateTime
}
}
'
variables='{
"eventId": "276754274"
}'
query="$(echo $query)"
curl -X POST https://api.meetup.com/gql \
-H 'Authorization: Bearer {YOUR_TOKEN}' \
-H 'Content-Type: application/json' \
-d @- <<EOF
{"query": "$query", "variables": "$variables"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment