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.
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 |
---|---|
19 | |
7 | |
7 | |
6 | |
5 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022