Back to Content Management API

sectionPublish

Publishes a section.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the section you want to 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
      title
      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",
            "title": "Section 1",
            "status": "published"
        }
    }
}

Was this page helpful?