Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
I'd like to load the schema into Postman in order to take advantage of autocomplete. Is it available to download?
https://learning.getpostman.com/docs/postman/sending_api_requests/graphql/
Solved! Go to the solution
This is an accepted solution.
Hi @Rusty-Dev,
The fact that Postman doesn't handle introspection automatically is why I personally use Insomnia for GraphQL queries. Hopefully they add it soon!
If you want to import the schema into Postman, you would need to fetch the schema yourself. I found what should be the query you need, but it's from a fairly old GIST so you may need to update it if there's information missing. Many coding languages have libraries that will do this for you as well.
Cheers,
Andrew | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
This is an accepted solution.
Hi @Rusty-Dev,
The fact that Postman doesn't handle introspection automatically is why I personally use Insomnia for GraphQL queries. Hopefully they add it soon!
If you want to import the schema into Postman, you would need to fetch the schema yourself. I found what should be the query you need, but it's from a fairly old GIST so you may need to update it if there's information missing. Many coding languages have libraries that will do this for you as well.
Cheers,
Andrew | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
where can i get Shopify's GraphQL Schema SDL ?
Hi @sandip001,
We don't expose it anywhere, but you can take a look at my above response for an example query that allows you to import our GQL schema. You'd fetch it by POSTing to /admin/api/the_version_you_want/graphql.json
Cheers
Andrew | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Thank you for the tips. I ended up switching to Insomnia and it's definitely easier to work with the GraphQL API.
I did get introspection to work by modifying the query:
query IntrospectionQuery { __schema { queryType { name } mutationType { name } subscriptionType { name } types { ...FullType } directives { name description args { ...InputValue } locations } } } fragment FullType on __Type { kind name description fields(includeDeprecated: true) { name description args { ...InputValue } type { ...TypeRef } isDeprecated deprecationReason } inputFields { ...InputValue } interfaces { ...TypeRef } enumValues(includeDeprecated: true) { name description isDeprecated deprecationReason } possibleTypes { ...TypeRef } } fragment InputValue on __InputValue { name description type { ...TypeRef } defaultValue } fragment TypeRef on __Type { kind name ofType { kind name ofType { kind name ofType { kind name } } } }
Then I converted the response to SDL using this and imported into Postman:
https://www.npmjs.com/package/graphql-introspection-json-to-sdl
Do you have any tips on getting the Shopify Storefront API Schema working with Insomnia? When I use `https://handle.myshopify.com/api/2021-07/graphql` as the URL, I get a "Got status 415 fetching schema from ..." error in Insomnia.
Never mind, I just needed to add a `Accept: application/json` to the headers in Insomnia