(Graphql Admin API) I want to get published product with collectionByHandle

tuanlead
Shopify Partner
6 0 0

Currently, when i get list products with Graphql Admin API using query "collectionByHandle" i get all product (published and unpublished). 

I'm try to use this query for filter published and then i get error access denied, do you have other query to get published products by collection handle?

{
  collectionByHandle(handle: "glass-combo-discount") {
    id
    title
    handle
    image {
      originalSrc
    }
    availablePublicationCount
    storefrontId
    templateSuffix
    products(first: 10, query: "published_status:published") {
      edges {
        node {
          id
          title
          publishedAt
        }
      }
    }
  }
}

 

i get result

{
  "data": {
    "collectionByHandle": null
  },
  "errors": [
    {
      "message": "access denied",
      "locations": [
        {
          "line": 12,
          "column": 5
        }
      ],
      "path": [
        "collectionByHandle",
        "products"
      ]
    }
  ],
  "extensions": {
    "cost": {
      "requestedQueryCost": 14,
      "actualQueryCost": 4,
      "throttleStatus": {
        "maximumAvailable": 2000.0,
        "currentlyAvailable": 1996,
        "restoreRate": 100.0
      }
    }
  }
}

 

0 Likes