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
:String
handle
:String
firstPublishedAt
:DateTime
firstPublishedAtTimezone
:String
description
:String
seo
:SEOInput
template
:String
sectionIds
:[ID!]
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
{
"pageUpdate": {
"id": "page-id",
"description": "This is my updated page.",
}
}