Search code examples
javascriptnode.jshttpfacebook-graph-apigraphql

POST request not accepting my GraphQL input


How do I get this post request to work:

{"query":"user(id: "jack") { getDetails { edges { node { name } } } name, description }"}

Even if I use single quotes it still does not work as it is an invalid JSON string.

The authorizations tokens are fine (bearer token)

I am using this site to test the POST request


Solution

  • You need to escape the quotes in your query to make it valid JSON.

    Try:

    {"query":"user(id: \"jack\") { getDetails { edges { node { name } } } name, description }"}