Ecommerce Shopify WordPress Discussion

Correct way to request publications

So I am currently trying to get all publication channels I can publish products at and am a bit confused... The channels query is depricated: https://shopify.dev/docs/api/admin-graphql/2023-07/queries/channels The publications query should be fine as of the documentation: https://shopify.dev/docs/api/admin-graphql/2023-07/queries/publications But if I exec the query, i get a deprication error: // Query: const sessions = await sessionStorage.findSessionsByShop(shop); const offline = sessions.find(s => !s.isOnline); if (offline) { const client = new shopifyAPP.clients.Graphql({ session, apiVersion: LATEST_API_VERSION, }); const result = await client.query({ data: ` query publications { publications(first: 10) { edges { node { id name } } } } ` }); } // Error: { message:"https://shopify.dev/api/usage/versioning#deprecation-practices", path:"https://xxxxxxxxxxxxx.myshopify.com/admin/api/2023-07/graphql.json", body: { query:" query publications { publications(first: 10) { ... } } " } } So what is the correct way to query the publication channel? Am i doing something wrong?
I think its endpoint related issue, You need to update your endpoint details // You are using old one https://xxxxxxxxxxxxx.myshopify.com/admin/api/2023-07/graphql.json // ^ HERE update this [2023-10] // You can use this new endpoint https://xxxxxxxxxxxxx.myshopify.com/admin/api/2023-10/graphql.json Answer Revised Seems there is a minor correction // HERE { (bracket) and ` (backtick) \/ wrong order. put bracket inside const result = await client.query({ data: { ` query publications { // <- Remove this publications(first: 10) { edges { node { id name } } } } // <- Remove this `} }); // ^^^ HERE put bracket inside HERE the bracket is supposed to be inside of the backtick (`) sign // correction const result = await client.query({ data: `{ publications(first: 10) { edges { node { id name } } } }` }); ref: https://shopify.dev/docs/api/admin-graphql if any doubt please comment

December 30, 2023

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.