2

The following GraphQL query runs perfectly fine in Github GraphQL Explorer:

$ cat GraphQL_query.graphql
query {
  __schema {
    types {
      name
      kind
      description
      fields {
        name
      }
    }
  }
}

however, when I send it via curl:

curl -H "Authorization: bearer token" -X POST -d "`cat GraphQL_query.graphql`" https://api.github.com/graphql

I'll get:

{
  "message": "Problems parsing JSON",
  "documentation_url": "https://developer.github.com/v4"
}

What's wrong? How can I make it works? Thx.

1

1 Answer 1

4

The curl syntax would look like this for that query:

$ curl -H "Authorization: Bearer $GITHUB_PRODUCTION_TOKEN" https://api.github.com/graphql -X POST -d '{"query":"query { __schema { types { name kind description fields { name } } } }","variables":"{}"}'
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.