Back to Content Management API
collectionPageUpdate
Updates a collection page.
Arguments
- Name
id
- Type
- ID!
- Description
The ID of the collection page you want to update.
- Name
input
- Type
- CollectionPageUpdateInput!
- Description
An object.
title
:String
firstPublishedAt
:DateTime
firstPublishedAtTimezone
:String
description
:String
template
:String
sectionIds
:[ID!]
Returns
- Name
CollectionPage.*
- Type
- CollectionPage
- Description
Any requested field from the Collectionpage object.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN'
});
const query = `
mutation CollectionPageUpdate($id: ID!, $input: CollectionPageUpdateInput!) {
collectionPageUpdate(id: $id, input: $input) {
id
title
handle
description
}
}
`;
const variables = {
id: 'YOUR-COLLECTION-PAGE-ID',
input: {
title: 'YOUR-TITLE',
firstPublishedAt: 'YOUR-FIRST-PUBLISHED-AT',
firstPublishedAtTimezone
description: 'YOUR-DESCRIPTION',
template: 'YOUR-TEMPLATE',
sectionIds: ['YOUR-SECTION-ID']
}
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"collectionPageUpdate": {
"id": "60f4b3b3b3b3b3b3b3b3b3b",
"title": "My Collection Page",
"handle": "my-collection-page",
"description": "This is my collection page."
}
}
}