Back to Content Management API
pageUpdate
Updates a page.
Arguments
- Name
id- Type
- ID!
- Description
The ID of the page you want to update.
- Name
input- Type
- PageUpdateInput!
- Description
An object.
title:Stringhandle:StringfirstPublishedAt:DateTimefirstPublishedAtTimezone:Stringdescription:Stringseo:SEOInputtemplate:StringThe title of the template to attach.sectionIds:[ID!]templateId:IDThe ID of the template to attach. Takes precedence overtemplate.sectionOverrides:JSONSection overrides for this content, as JSON.draftId:IDLegacy, from the drafts system that Content Releases replaced. To read or write a release's changes, send theX-Pack-Release-Idheader instead. See Content Releases.
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 = `
fragment PageResourceFields on PageResource {
id
description
}
mutation PageUpdate($id: ID!, $input: PageUpdateInput!) {
pageUpdate(id: $id, input: $input) {
...PageResourceFields
}
}
`
const variables = {
id: "page-id",
input: {
description: "This is my updated page.",
}
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"pageUpdate": {
"id": "page-id",
"description": "This is my updated page."
}
}
}