A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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?
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
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?
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?