New to GraphQL; just spent quite a bit of time stuck on an apparent inconsistency in API responses between my Checkout Extension and GraphiQL before I realised that my extension was querying the Storefront API while GraphiQL was querying the Admin API.
When using the store-installed version of GraphiQL there is a dropdown allowing a choice of these APIs:
However when using the version of GraphiQL that is provided by the Shopify CLI (running shopify app dev), there is no such dropdown (I can’t include a screenshot as my user account is new, however hopefully you can take my word for it).
Should I expect to see a choice within the CLI version of the GraphiQL tool? Could this be a scopes issue? Any other way to select between the different APIs?
I believe it will always be the Admin API that you’ll be making calls to, when using the CLI and not the Storefront API. Do you want to make Storefront API calls via GraphiQL on the CLI? What would be your use case for having access to the Storefront API via this version of GrapiQL?
Hi Liam, thanks for your message. OK, understood. My specific use-case was trying to draft and test queries that would ultimately be run by the Checkout Extension I was developing, which uses the Storefront API. Given that the store-installable version of GraphiQL allows a choice of APIs, I would expect the CLI version to offer the same, and given how easy the CLI makes it to launch GraphiQL (a single keypress within the shopify app dev interface) there’s definitely the potential for confusion if the API is effectively hardcoded. However it’s not a blocker for me right now as I’m using the store-installed version for this testing. Does that help? Thanks again.