I've tried to use variables with graphql, but it seems impossible to send variables with 'application/graphql'.
Should i have to move on to Content-Type: 'application/json'?
I've tried to use variables with graphql, but it seems impossible to send variables with 'application/graphql'.
Should i have to move on to Content-Type: 'application/json'?
http://graphql.org/learn/serving-over-http/#post-request
In my understanding,
Content-Type: "application/graphql"
is Shorthand for Querying without variables.So my answer is "Yes, If I want to use variables field, I have to use
Content-Type: "application/json"
headerWhat prevents you from passing the variables in the query string and the query in the body?
According to Facebook's express-graphql HTTP Usage, variables can be passed as URL parameters. Here is an example:
For
application/json
, there is separate section for variables. For POST body withapplication/graphql
and GET requests, URL query:variables={...}
can be used.