Last active
October 26, 2021 18:09
-
-
Save kyanny/7691b84209689d8c5ec2b4fae19a7ddc to your computer and use it in GitHub Desktop.
Call GraphQL API with curl.
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
#!/bin/bash | |
# Usage: bash graphql.sh < query.txt | |
query=$(cat - | sed -e 's/"/\\"/g' | tr -d '\n') | |
cat <<EOM> query.json | |
{"query":"$query"} | |
EOM | |
curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/graphql -d @query.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment