Back to Content Management API
pageUpdateBulk
Allows you to bulk update product pages.
Arguments
- Name
ids- Type
- [ID!]
- Description
Array of product page IDs that you want to update.
- Name
input- Type
- [ProductPageUpdateInput!]!
- 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 ProductPageUpdateBulk($ids: [ID!]!, $input: [ProductPageUpdateInput!]!) {
productPageUpdateBulk(ids: $ids, input: $input) {
id
}
}
`;
const variables = {
"ids": ["product-page-id-1", "product-page-id-2"],
"input": [
{
"title": "New Title",
"firstPublishedAt": "2022-01-01T00:00:00Z",
"firstPublishedAtTimezone": "America/New_York",
"description": "New Description",
"template": "New Template",
"sectionIds": ["section-id-1", "section-id-2"]
},
{
"title": "New Title 2",
"firstPublishedAt": "2022-01-01T00:00:00Z",
"firstPublishedAtTimezone": "America/New_York",
"description": "New Description 2",
"template": "New Template 2",
"sectionIds": ["section-id-3", "section-id-4"]
}
]
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"productPageUpdateBulk": {
"id": "1"
}
}
}