Using GraphQL query

POST https://swapi.apis.guru

Similar to the previous example from this community tutorial, we learn that if the GraphQL endpoint accepts the header application/graphql, then we don't need to use JSON in the request body.

Add the header Content-type: application/graphql, and then you can use a standard graphQL query in the request body.

[standard graphQL query](https://i.imgur.com/GMP3Eiz.png)

Request Body

{"query"=>"query { allFilms { films { id title episodeID } } }"}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring

RESPONSES

status: OK

{"data":{"allFilms":{"films":[{"id":"ZmlsbXM6MQ==","title":"A New Hope","episodeID":4},{"id":"ZmlsbXM6Mg==","title":"The Empire Strikes Back","episodeID":5},{"id":"ZmlsbXM6Mw==","title":"Return of the Jedi","episodeID":6},{"id":"ZmlsbXM6NA==","title":"The Phantom Menace","episodeID":1},{"id":"ZmlsbXM6NQ==","title":"Attack of the Clones","episodeID":2},{"id":"ZmlsbXM6Ng==","title":"Revenge of the Sith","episodeID":3}]}}}