Back to Content Management API

blogUnpublish

Unpublishes blog.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the blog you want to unpublish.

  • Name
    includeSections
    Type
    [ID!]
    Description

    Optional. By default, the blog's sections stay published. Pass section IDs to unpublish those sections too.

Returns

  • Name
    Blog.*
    Type
    Blog
    Description

    Any requested field from the Blog object.

Request

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

const query = `
  mutation BlogUnpublish($id: ID!) {
    blogUnpublish(id: $id) {
      id
      title
      handle
      description
      sections {
        nodes {
          id
          title
        }
      }
    }
  }
`;

const variables = {
  id: 'blog-id'
};

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

Response

{
    "data": {
        "blogUnpublish": {
            "id": "blog-id",
            "title": "Blog Title",
            "handle": "blog-title",
            "description": "Blog Description",
            "sections": {
                "nodes": [
                    {
                        "id": "section-id",
                        "title": "Section Title"
                    }
                ]
            }
        }
    }
}

Was this page helpful?