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
- Set your request
URL
(Unlike REST, this is likely a single API endpoint for all requests - Set your
Method
(May or may not matter. In my case, any have worked) - Set your
Headers
(API keys likely going here) - Select
Application/x-www-form-urlencoded
as yourBody type
- Set your
Fields
Item 1
Key:
query
(Note: This will bequery
regardless of whether it is a query, mutation, subscription, webhook, or any other top-level entry that your platform usesValue:
`[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
Item 2
Key:
variables
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
- Set
Parse response
toYes
(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!