Testing a GraphQL API using Postman
About this task
You must assess the GraphQL API created is working as expected before exposing it to the API consumers. You should verify the correct status code of the response. For instance, successful HTTP requests should return 200 OK, creating a resource should return 201 CREATED, and so on.
Let’s test the Starwars GraphQL API, which was imported using a file. In this example, to test whether the Star Wars API is created successfully, let’s retrieve all the films in the Star Wars franchise using the Starwars API. The API response should list all the films in the Star Wars franchise.
Before you begin
Ensure that you have:
- Postman installed in your system, or you can you use the web version of Postman.
- Downloaded the sample Star Wars Postman collection GraphQL.postman_collection.json from the Github repository https://github.com/SoftwareAG/webmethods-api-gateway/tree/master/gettingstarted/graphql.
Procedure
What to do next
For details about the further actions you can perform on the API, see All about APIs in the API Gateway User's Guide.