Back to Content Management API
pages
Returns array of all your pages in a draft or published state paginated by a cursor.
Arguments
- 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. Maximum value is 25.
- Name
last
- Type
- Int
- Description
Returns up to the last
n
elements from the list.
- Name
version
- Type
- Version
- Description
The state of the page you want to retrieve.
- To get the latest content use
CURRENT
. - To get the latest published content use
PUBLISHED
- To get the latest content use
Returns
- Name
PageConnection.edges
- Type
- [PageEdge!]!
- Description
A list of edges.
- Name
PageConnection.nodes
- Type
- [Page!]!
- Description
A list of the nodes contained in PageEdge.
- Name
PageConnection.pageInfo
- Type
- PageInfo!
- Description
Information to aid in pagination.
- Name
PageConnection.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 pages {
pages {
edges {
cursor
node {
id
title
handle
}
}
totalCount
}
}
`;
const response = await packClient.fetch(query);
console.log(response.data);
Response
{
"data": {
"pages": {
"edges": [
{
"cursor": "cursor-id",
"node": {
"id": "page-id",
"title": "page-title",
"handle": "page-handle"
}
},
{
"cursor": "cursor-id",
"node": {
"id": "page-id",
"title": "page-title",
"handle": "page-handle"
}
},
],
"totalCount": 2
}
}
}