Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

I can't filter by app_id in the catalogs query

I can't filter by app_id in the catalogs query

Zet
Shopify Partner
5 0 10

So I've been trying to fetch the Online store sales channel's publicationId with the following query but the results are always empty:

 

query GetOnlineStorePublication ($query:String) {
  catalogs(type: APP, query:$query, first: 100) {
    nodes {
      id
      title
      publication {
        id
      }
    }
  }
}

Where the variables are the following

 

 

{
  "query": "app_id:580111"
}

Now, I feel this should work, seeing as the app gid for the "Online Store" is gid://shopify/App/580111

Is there anything I'm missing here?

 

Replies 3 (3)

Liam
Community Manager
3108 344 909

Hi Zet,

 

Could you use the publication query instead? eg:

query GetOnlineStorePublicationId {
  publication(id: "gid://shopify/Publication/ONLINE_STORE_PUBLICATION_ID") {
    id
    name
  }
}

 

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

Zet
Shopify Partner
5 0 10

Hey Liam,

 

That one does work, of course, but I don't actually have access to the publication id of the online store. It's what I'm trying to get with my query. I'm trying to retrieve it in an efficient way, which the catalogs query seemed to have with its app_id filter but it does not work. 

 

For now I just get a whole bunch of publications and filter them on the backend but that's pretty inefficient. 

 

Do you have any idea why the query I provided initially does not work? It seems to me that there's a bug in the graphql API itself, as I can't find anything wrong with it. I'm not actually sure where to submit the issue if that's the case, perhaps the partner's API support?

dusan_madar
Shopify Partner
1 0 1

Trying to achieve exactly the same thing and can confirm `app_id` query does not work, API version `2024-04`.

 

query {
  catalogs(first: 5, type: APP, query:"app_id:580111") {
    edges {
      node {
        ... on AppCatalog {
          apps(first: 5) {
            nodes {
              id
              handle
              title
              shopifyDeveloped
            }
          }
        }
        id
        publication {
          id
        }
      }
    }
  }
}

Shopify GraphiQL App response to the above query

{
  "data": {
    "catalogs": {
      "edges": []
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 23,
      "actualQueryCost": 2,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1943,
        "restoreRate": 100
      }
    },
    "search": [
      {
        "path": [
          "catalogs"
        ],
        "query": "app_id:580111",
        "parsed": {}
      }
    ]
  }
}

 

@Liam any update on this, please?