Acquiring ids for use with publishablePublish

garthtogle
Tourist
4 0 1

publishablePublish seems to require an input structured like this:

 

{
"id": "[id1]",
"input": [
{

"publicationId" :  "[id2]",

"publishDate" : "[datetime]"

}
]
}

 

 

The api documents suggest an odd value for 'id', which doesn't appear to be a normal GraphQL id. In addition, I can't seem to locate the publicationId required to publish a product. Since the publication fields on the product mutation are currently deprecated, we decided to begin using publishablePublish, but are unsure how to proceed. 

 

When running a query against publications to ask for the first (x) nodes with their ids and names, we get an 'access denied' error on 'publications' itself, suggesting we don't have read access. Checking the private application that is running the API, I can't find any way to grant read (or write, for that matter) access to Publications.

 

Really, we're just trying to figure out how to publish products in the latest API. 

 

Two questions:

1. what is the "id" with the input on publishablePublish? I assume this would be the product's ID, but the example shown looks like a hash or digest, or an encoded string.

2. where do we get the publication ID for our web store, since this is where we will be publishing the products?

 

Thanks.

Alex
Shopify Staff
Shopify Staff
1555 81 296

The ID you're probably seeing is a Base64 encoded string, assuming you're seeing `Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=`. Decoding the example from the docs gives me `gid://Shopify/Example/1`, so it gives us a general pattern to follow. So in this case, you'd want to give it a base64 encoded collection or product GID.

 

This is all assuming you have access to write_publications as an access scope, where my understanding is that we're not granting this scope to apps that are not internal just yet. A bit of an issue with our graphql docs construction engine which we're looking into. This also explains the more ambiguous nature of getting the online store publication ID, which we have internally.

 

Regardless, I've taken this as feedback to pass to the concerned teams. Let me know if you have any additional thoughts or questions to share.

 

Cheers.

0 Likes
garthtogle
Tourist
4 0 1

What is a time-frame here? I will have to re-implement using the REST API for products if I cannot publish them.

0 Likes
Alex
Shopify Staff
Shopify Staff
1555 81 296

I don't have a time frame I can share on this one unfortunately. Your best short term solution for now would be to use REST for the time being. I'll update this thread when any updates appear on this one.

0 Likes
Jonny8
Shopify Expert
4 0 1

Sharing pain felt here. :) 

Chris_Marshall1
Shopify Partner
24 1 7

Any update on this?

azacs
Shopify Partner
9 0 12

So the other method is depreciated and still nobody is able to use the new method almost a year later? 

I just want all products I create to be in the online channel by default.

 

Edit:

Turns out if you only care about online channel the following works:

 

productCreate(input: {
            title: "product name",
            productType: "test",
            published: true
}
)

What a nightmare for such a simple thing

sethness
New Member
4 0 0

This is pretty ridiculous.

How are we supposed to set future publications dates if we're still forced to use the deprecated 'published' attribute and not the documented publishable methods?

I've been knee deep in Shopify APIs for about two weeks now and the state of affairs is a little bit frightening.

Anyone here have any experience with any Shopify alternatives? Big Commerce or the likes?

 

ANything any better?

0 Likes