GraphQL API - publishable product to Current Channel

New Member
4 0 0

Hi Everyone,
I am new to Shopify app development. I am also stuck at publishablePublishToCurrentChannel mutation of the GraphQL API. I am trying to publish user-selected product to my channel. below is my code

 

const UPDATE_CHANNEL= gql`
mutation publishablePublishToCurrentChannel($id: ID!) {
  publishablePublishToCurrentChannel(id: $id) {
    publishable {
      availablePublicationCount
      publicationCount
      publishedOnCurrentPublication
      publishedOnPublication
    }
    shop {
      id
    }
    userErrors {
      field
      message
    }
  }
}
`;
{
  "id": "gid://shopify/Product/xxxxxxxxxxxx"
}

Its returning following error

{
    "errors": [
        {
            "extensions": {
                "arguments": "publicationId",
                "className": "Field",
                "code": "missingRequiredArguments",
                "name": "publishedOnPublication"
            },
            "locations": [
                {
                    "column": 7,
                    "line": 7
                }
            ],
            "message": "Field 'publishedOnPublication' is missing required arguments: publicationId",
            "path": [
                "mutation publishablePublishToCurrentChannel",
                "publishablePublishToCurrentChannel",
                "publishable",
                "publishedOnPublication"
            ]
        }
    ]
}

Any help would be appreciated

0 Likes
New Member
4 0 0

I tried as per other discussions still now seeing access denied, please help to resolve 

 

mutation publishablePublishToCurrentChannel($id: ID!) {
  publishablePublishToCurrentChannel(id: $id) {
    
    userErrors {
      field
      message

    }
  }
}
response 
{
    "data": {
        "publishablePublishToCurrentChannel": null
    },
    "errors": [
        {
            "locations": [
                {
                    "column": 3,
                    "line": 2
                }
            ],
            "message": "PublishablePublishToCurrentChannel access denied",
            "path": [
                "publishablePublishToCurrentChannel"
            ]
        }
    ],
    "extensions": {
        "cost": {
            "actualQueryCost": 10,
            "requestedQueryCost": 10,
            "throttleStatus": {
                "currentlyAvailable": 990,
                "maximumAvailable": 1000.0,
                "restoreRate": 50.0
            }
        }
    }
}

 

0 Likes
Shopify Staff
Shopify Staff
618 45 84

Hi @Alex_Pn,

 

Does your app have write_publications scope? If it doesn't, that explains the access denied error.

 

This scope is currently protected and must be enabled on your app by a Shopify employee. Until this is released to a broader audience, it's only able to be applied to private apps installed on Plus shops. If that describes your app, private message me your API key and I can enable the scopes. Otherwise, stay tuned to our developer changelog for updates.

0 Likes
Highlighted
New Member
4 0 0

Thanks @Busfox  , My app is currently under development is it possible to enable it for dev purposes only.  Is there road map to release this to all shops? Please let me know if it's possible using rest API?

Thanks for help

0 Likes