Back to Content Management API

collectionPageHistory

Returns array of all revisions for the collection page by ID paginated by a cursor.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the collection page.

  • Name
    after
    Type
    String
    Description

    Returns the elements that come after the specified cursor.

  • Name
    before
    Type
    String
    Description

    Returns the elements that come before the specified cursor.

  • Name
    first
    Type
    Int
    Description

    Returns up to the first n elements from the list.

  • Name
    last
    Type
    Int
    Description

    Returns up to the last n elements from the list.

Returns

  • Name
    CollectionPageRevisionConnection.edges
    Type
    [CollectionPageEdge!]!
    Description

    A list of edges.

  • Name
    CollectionPageRevisionConnection.nodes
    Type
    [CollectionPageRevision!]!
    Description

    A list of the nodes contained in CollectionPageRevisionEdge.

  • Name
    CollectionPageRevisionConnection.pageInfo
    Type
    PageInfo!
    Description

    Information to aid in pagination.

  • Name
    CollectionPageRevisionConnection.totalCount
    Type
    Int
    Description

    The total count of items.

Request

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

const query = `
query CollectionPageHistory($id: ID!, $cursor: String) {
  collectionPageHistory(id: $id, first: 10, after: $cursor) {
    nodes {
      title
      handle
      description 
    }
  }
}
`
const variables = {
  id: 'product-page-id',
  revisionId: 'revision-id'
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
    "data": {
        "collectionPageHistory": {
            "nodes": [
                {
                    "title": "Collection Title",
                    "handle": "collection-handle",
                    "description": "Collection Description"
                },
                {
                    "title": "Collection Title",
                    "handle": "collection-handle",
                    "description": "Collection Description"
                }
            ]
        }
    }
}

Was this page helpful?