Graphql post body "Must provide query string."

Using Postman Version 7.2.2 I had a similar issue. This version of Postman supports Graphql out of the box. Changing the Content-type to application/json fixed it for me.

Image showing the Content-type in Postman


Post request needs to manage headers info.

  1. Using Http client - Content-Type: application/json

  2. Using Postman client - Content-Type: application/graphql

but request body looks like string

{"query":"mutation{update(id:1,x1:\"zazaz\",x2:\"zazaz\"......){id x1 x2}}"}

If you are using graphql and want to test it using postman or any other Rest client do this.

In postman, select POST method and enter your URL and set Content-Type as application/graphql then pass your query in the body.

Example:

http://localhost:8080/graphql
Mehtod: POST
Content-Type: application/graphql
Body: 
  query{
    FindAllGames{
    _id
    title
    company
    price
    year
    url
   }
 }

Thats it you will get the response.

enter image description here