Back to Content Management API

blogUnpublish

Unpublishes blog.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the blog you want to unpublish.

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
      author
      category
      tags
      sections {
        id
        title
        handle
        description
      }
    }
  }
`;

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",
            "author": "Author Name",
            "category": "Category Name",
            "tags": ["tag1", "tag2"],
            "sections": [
                {
                    "id": "section-id",
                    "title": "Section Title",
                    "handle": "section-title",
                    "description": "Section Description"
                }
            ]
        }
    }
}

Was this page helpful?