Back to Content Management API
pageAddSectionsBulk
Adds sections to multiple pages.
Arguments
- Name
ids
- Type
- [ID!]
- Description
Array of page IDs that you want to add sections to.
- Name
input
- Type
- [PageAddSectionsInput!]!
- Description
An object that accepts an array of
sectionIds
and asrategy
for how to handle the sections attached to the pages.sectionIds
: array of section IDsstrategy
:clone | link
Returns
- Name
Job.*
- Type
- Job
- Description
Any requested field from the Job object.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN'
});
const query = `
mutation PageAddSectionsBulk($ids: [ID!]!, $input: [PageAddSectionsInput!]!) {
pageAddSectionsBulk(ids: $ids, input: $input) {
id
}
}
`;
const variables = {
ids: ['page-id-1', 'page-id-2'],
input: [
{
sectionIds: ['section-id-1', 'section-id-2'],
strategy: 'clone'
}
]
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"pageAddSectionsBulk": {
"id": "1"
}
}
}