Curl a GraphQL API

Curl a GraphQL API

Updated: May 11, 2021
Programming GraphQL CommandLine

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.