Back to Content Management API

collectionPageByHandle

Returns a collection page by handle in a draft or published state.

Arguments

  • Name
    handle
    Type
    String!
    Description

    The handle of the collection page.

  • Name
    version
    Type
    Version
    Description

    The state of the collection page you want to retrieve.

    • To get the latest content use CURRENT.
    • To get the latest published content use PUBLISHED

Returns

Request

import { PackClient } from '@pack/client'
const packClient = new PackClient({
  token: 'YOUR-PACK-TOKEN'
});

const query = `
query GetCollectionPageByHandle($handle: String!, $version: Version) {
      collectionPageByHandle(handle: $handle, version: $version) {
        title
        handle
        description
      }
    }
`
const variables = {
  id: 'collection-page-id',
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
    "data": {
        "collectionPageByHandle": {
            "title": "Collection Page Title",
            "handle": "collection-page-title",
            "description": "Collection Page Description"
        }
    }
}

Was this page helpful?