Back to Content Management API
sectionHistory
Returns array of all revisions for the section by ID paginated by a cursor.
Arguments
- Name
id
- Type
- ID!
- Description
The ID of the section.
- 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
SectionRevisionConnection.edges
- Type
- [SectionRevisionEdge!]!
- Description
A list of edges.
- Name
SectionRevisionConnection.nodes
- Type
- [SectionRevision!]!
- Description
A list of the nodes contained in SectionRevisionEdge.
- Name
SectionRevisionConnection.sectionInfo
- Type
- SectionInfo!
- Description
Information to aid in pagination.
- Name
SectionRevisionConnection.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 SectionHistory($id: ID!, $after: String, $before: String, $first: Int, $last: Int) {
sectionHistory(id: $id, after: $after, before: $before, first: $first, last: $last) {
edges {
cursor
node {
title
handle
description
}
}
totalCount
}
}
`
const variables = {
id: 'section-id',
after: 'cursor',
before: 'cursor',
first: 10,
last: 10
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"sectionHistory": {
"edges": [
{
"cursor": "cursor",
"node": {
"title": "Section Title",
"handle": "section-title",
"description": "Section Description"
}
}
],
"totalCount": 1
}
}
}