Back to Content Management API
pageByHandle
Returns a page by hande in a draft or published state.
Arguments
- Name
handle
- Type
- String!
- Description
The handle of the page.
- 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
Page*
- Type
- Page
- Description
Any requested field from the page object.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN'
});
const query = `
query pageByHandle($handle: String!) {
pageByHandle(handle: $handle) {
id
title
}
}
`;
const response = await packClient.fetch(query, { variables: { handle: 'your-page-handle' } });
console.log(response.data);
Response
{
"data": {
"pageByHandle": {
"id": "your-page-id",
"title": "your-page-title"
}
}
}