Development discussions around Shopify APIs
This is an accepted solution.
Here's where it appears you'd need to get started --> https://shopify.dev/docs/admin-api/graphql/reference/object/publication?api[version]=2020-07.
This is an accepted solution.
Here's where it appears you'd need to get started --> https://shopify.dev/docs/admin-api/graphql/reference/object/publication?api[version]=2020-07.
thx, but it's GraphQL API, where is the RESTful Publication api ? I can't found it.
I can't find it either 🙂 Most likely this endpoint is only accessible using the GraphQL API. I had to resort to using it for a few queries that weren't possible using the REST API. Once you get used to the JSON request body format of these GraphQL queries it isn't that formidable. You can even test things out by trying out the real-time Shopify GraphQL explorer --> https://shopify.dev/tools/graphiql-admin-api.
thank you!
hello, can you give me some example code to get this ID number through GraphQL API?
Here's a sample that would retrieve the first 10 publication channels for the Shopify shop.
{ publications (first: 10){ edges { node { id name } } } }
And here is a sample, where I know the GID of a specific Shopify product. And use that to query various properties. The results will show the id and name of each published channel and the id and name of the channels where the product isn't published. You can determine the GID of a product by the REST API response for GET'ing a product. The field in the response is admin_graphql_api_id.
{ product(id: "gid://shopify/Product/4425923133492") { availablePublicationCount collections(first: 5) { edges { node { handle } } } createdAt defaultCursor description descriptionHtml featuredImage { id } feedback { details { messages { message } } } giftCardTemplateSuffix handle hasOnlyDefaultVariant hasOutOfStockVariants id images(first: 5) { edges { node { id } } } isGiftCard legacyResourceId metafield(key: "app_key", namespace: "affiliates") { description } metafields(first: 5) { edges { node { description } } } onlineStorePreviewUrl onlineStoreUrl options { name } priceRange { maxVariantPrice { amount } minVariantPrice { amount } } productType publicationCount publishedAt resourcePublications(first: 10) { edges { node { isPublished publication { id name } } } } seo { title } storefrontId tags templateSuffix title totalInventory totalVariants tracksInventory unpublishedPublications(first: 5) { edges { node { id name } } } updatedAt variants(first: 5) { edges { node { displayName } } } vendor } }
User | RANK |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023