Crafting a GraphQL Query

This is a “mini-guide” on crafting GraphQL requests with Make. I continued to find information that was incomplete, incorrect, or partially accurate - so I wanted to create this as a resource to help my future-Googler, and hopefully assist some others banging their head on the table.

More and more APIs seem to be switching over to GraphQL, and while I’m learning to love it - I’m still finding it regularly finding it to be a head-scratcher and a lot of documentation to be non-obvious.

Anyway - here’s to crafting a GraphQL query in Make. I expect this won’t work for everyone, but so far it’s worked for all of my requests on all platforms.

Create a new HTTP Module

  1. Set your request URL (Unlike REST, this is likely a single API endpoint for all requests
  2. Set your Method (May or may not matter. In my case, any have worked)
  3. Set your Headers (API keys likely going here)
  4. Select Application/x-www-form-urlencoded as your Body type
  5. Set your Fields
    1. Item 1
      1. Key: query (Note: This will be query regardless of whether it is a query, mutation, subscription, webhook, or any other top-level entry that your platform uses
      2. Value: `[Your actual GraphQL query. This should not be JSON, but should be a plain query - same as what would work inside of GraphiQL or another GraphQL IDE
    2. Item 2
      1. Key: variables
      2. Value: `[Your actual GraphQL variables. This should not be JSON, but should be a plain query - same as what would work inside of GraphiQL or another GraphQL IDE
  6. Set Parse response to Yes (Optional - but recommended as I feel it makes the response easier upon inspection + if you’re going to run it through a JSON parser later anyway saves a step.

Hope that helps some others!

2 Likes

Hey @TJ :wave:

Thank you so much for summarizing and sharing your mini-guide with us here! I am sure that it will be helpful for many of our users! :pray:

Keep up the amazing job!

2 Likes

Thank you for the great insights. My setup was slightly different and also worked for queries and mutations.

4 Likes