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: String
    • firstPublishedAt: DateTime
    • firstPublishedAtTimezone: String
    • description: String
    • template: String
    • sectionIds: [ID!]

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 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"
        }
    }
}

Was this page helpful?