Back to Content Management API

collectionPagePublish

Publishes a collection page.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the page you want to publish.

  • Name
    publishComment
    Type
    String
    Description

    An optional string to comment on the page publish.

Returns

Request

import { PackClient } from '@pack/client'
const packClient = new PackClient({
  token: 'YOUR-PACK-TOKEN'
});

const query = `
  mutation CollectionPagePublish($id: ID!, $publishComment: String) {
    collectionPagePublish(id: $id, publishComment: $publishComment) {
      id
      title
      handle
      description
    }
  }
`;

const variables = {
  id: 'YOUR-PAGE-ID',
  publishComment: 'YOUR-PUBLISH-COMMENT'
};

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

Response

{
  "data": {
    "collectionPagePublish": {
      "id": "60f4b3b3b3b3b3b3b3b3b3b",
      "title": "My Page",
      "handle": "my-page",
      "description": "My page description"
    }
  }
}

Was this page helpful?