Back to Content Management API
pageUpdateBulk
Allows you to bulk update collection pages.
Arguments
- Name
ids- Type
- [ID!]
- Description
Array of collection page IDs that you want to update.
- Name
input- Type
- [CollectionPageUpdateInput!]!
- Description
Array of objects for each corresponding page ID to update.
title:StringfirstPublishedAt:DateTimefirstPublishedAtTimezone:Stringdescription:Stringtemplate:StringThe title of the template to attach.sectionIds:[ID!]seo:SEOInputtemplateId: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
Job- Type
- Job
- Description
The
idof the background job that runs the bulk operation.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN'
});
const query = `
mutation CollectionPageUpdateBulk($ids: [ID!]!, $input: [CollectionPageUpdateInput!]!) {
collectionPageUpdateBulk(ids: $ids, input: $input) {
id
}
}
`;
const variables = {
ids: ['<COLLECTION_PAGE_ID>', '<COLLECTION_PAGE_ID>'],
input: [
{
title: 'New Title',
firstPublishedAt: '2022-01-01T00:00:00Z',
firstPublishedAtTimezone: 'America/New_York',
description: 'New Description',
template: 'default',
sectionIds: ['<SECTION_ID>', '<SECTION_ID>']
}
]
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"collectionPageUpdateBulk": {
"id": "1"
}
}
}