Back to Content Management API

sectionPublish

Publishes a section.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the section you want to publish.

  • Name
    publishComment
    Type
    String
    Description

    An optional string to comment on the section publish.

Returns

  • Name
    section.*
    Type
    section
    Description

    Any requested field from the section object.

Request

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

const query = `
  mutation sectionPublish($id: ID!) {
    sectionPublish(id: $id) {
      id
      name
      status
    }
  }
`;
const variables = {
  id: 'YOUR-SECTION-ID'
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
  "data": {
    "sectionPublish": {
      "id": "section-1",
      "name": "Section 1",
      "status": "published"
    }
  }
}

Was this page helpful?