Back to Content Management API

pageUpdateBulk

Allows you to bulk update pages.

Arguments

  • Name
    ids
    Type
    [ID!]
    Description

    Array of page IDs that you want to update.

  • Name
    input
    Type
    [PageUpdateInput!]!
    Description

    Array of objects for each corresponding page ID to update.

    • title: String
    • handle: String
    • firstPublishedAt: DateTime
    • firstPublishedAtTimezone: String
    • description: String
    • seo: SEOInput
    • 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 PageUpdateBulk($ids: [ID!]!, $input: [PageUpdateInput!]!) {
  pageUpdateBulk(ids: $ids, input: $input) {
    id
  }
}
`
const variables = {
  ids: [
      "page-id-1",
      "page-id-2"
  ],
  input: [
      {
          template: "Page"
      },
      {
          template: "Page"
      }
  ]
}

const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
    "data": {
        "pageUpdateBulk": {
            "id": "job-id"
        }
    }
}

Was this page helpful?