mark@usegitflow:~$

How to Insomnia for GraphQL requests

August 11, 2019 · Blog · 2 min read

Complete video tutorial is online😼 Please check here. Total time would be within 8 minutes.

Use cases when we work with a GraphQL endpoint

  • Send my first request to a new GraphQL endpoint
  • Introspection query to fetch the schema
  • Manage environment related variables
    • Authentication
    • Frequently used variables
  • Manage a bunch of queries
    • Save
    • Share
    • Team Collaboration (for subscriber)

How to use Insomnia to manage my requests?

Please check the complete youtube videos for demo!

Here we’re going to communicate with Github’s public GraphQL API. Basic steps would be:

  1. Automatically fetch the GraphQL Schema from the endpoint.
  2. Authenticating the requests through a personal access token, set the token as an environment variable.
  3. Construct your query with the auto-complete feature enabled. Use variables when needed.
  4. Send and check your response, work on fixing errors.
  5. Export your current workspace and send it to your teammates. (Or use ‘Share’ feature which requires an Insomnia Plus subscription. 💰)

References


tags: GraphQL, Web Development