Back to Content Management API

productPagePublish

Publishes a product 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

  • Name
    ProductPage.*
    Type
    ProductPage
    Description

    Any requested field from the Productpage object.

Request

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

const query = `
  mutation ProductPagePublish($id: ID!, $publishComment: String) {
    productPagePublish(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": {
    "productPagePublish": {
      "id": "YOUR-PAGE-ID",
      "title": "YOUR-PAGE-TITLE",
      "handle": "YOUR-PAGE-HANDLE",
      "description": "YOUR-PAGE-DESCRIPTION"
    }
  }
}

Was this page helpful?