Sending GraphQL requests using Postman
Softwares have bugs. Sometimes when we use our system, we notice an error or something unexpected returned on the UI. It is often easier to investigate by sending in the specific problematic request to the server.
What is the easiest way to send the specific GraphQL request to the server via Postman?
- Copy the gql query from the developer console as cURL
- import the cURL to Postman
Da La! Now you can send GraphQL request of interest to server directly using Postman.
Notice there are lots of \n
in the query. We can find and replace them in a text editor like VS Code.
In VS Code, we can open the ‘find and replace’ mode, and check the option ‘Use regular expression’. In the Find input, enter \\n
. In the Replace input \n
. All of the \n
would be changed to new line.
You can also copy and paste the prettified queries to tools like GraphQL Playground and send requests to server!