Curl a GraphQL API
Updated: May 11, 2021
curl -0 -v -X POST https://some.api.com/graphql \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"query": "query { someQuery (someArg: false) { name } }"
}
EOF
curl
will probably complain about the -X POST
being inferred, but it shouldn’t harm anything. It can be left out.