Back to Content Management API

page

Returns a page by ID in a draft or published state.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID 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

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 Page($id: ID!) {
  page(id: $id) {
    id
    title
  }
}
`;
const response = await packClient.fetch(query, { variables: { id: 'YOUR-PAGE-ID' } });
console.log(response.data);

Response

{
    "data": {
        "page": {
            "id": "0190e0f1-56ce-7057-b325-31ab648e58cb",
            "title": "Testing Page"
        }
    }
}

Was this page helpful?