I'm getting storefrontId instead of gid for collections (GraphQL)

mashkovtsev
Shopify Partner
38 1 27

Hi. 

I'm trying to get some collections gid's using GraphQL. Everything works good when I'm trying to get them using GraphQL app. But when I'm trying to get them using my private app - I receive storefrontId instead of gid.

 

Here's my query:

{
  collections(first: 200, query: "title:Bebe OR title:Enfant") {
    edges {
      node {
        id
      }
    }
  }
}

Everything works fine in GraphQL App:

34.png

But not fine in Postman, for example:

35.png

I tried different methods and API versions, but nothing helped.

Please, help me with this problem

All the best.
Alex, Team Lead at Infinite Solutions Shopify Studio
https://inso.codes/
Reply 1 (1)

_JB
Shopify Staff
836 100 222

Hey @mashkovtsev,

 

The results you're seeing appear to be from the storefront API. Can you confirm that you're using basic auth and making your calls to https://{{store_name}}.myshopify.com/admin/api/{{version}}/graphql.jsonin Postman?

 

The admin graphQL API uses basic auth + the admin link above to communicate with Shopify. In you're using an access token and missingadmin in the URL, that means you're making calls to the storefront API and you'll want to switch to the admin API to get the expected collection_ids.

 

If you already are using the admin API and still getting unexpected results, please provide the api_client_id of your app or the x-shopify-request-id from the response headers in Postman, and we can investigate further.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog