Back to Content Management API

articleUnpublish

Unpublishes article.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the article you want to unpublish.

Returns

  • Name
    Article.*
    Type
    Article
    Description

    Any requested field from the Article object.

Request

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

const query = `
  mutation ArticleUnpublish($id: ID!) {
    articleUnpublish(id: $id) {
      id
      title
      handle
      description
      author
      category
      tags
      sections {
        id
        title
        handle
        description
      }
    }
  }
`;

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

Response

{
    "data": {
        "articleUnpublish": {
            "id": "article-id-1",
            "title": "Article Title",
            "handle": "article-title",
            "description": "Article description",
            "author": "Author Name",
            "category": "Category Name",
            "tags": ["tag1", "tag2"],
            "sections": [
                {
                    "id": "section-id-1",
                    "title": "Section Title",
                    "handle": "section-title",
                    "description": "Section description"
                }
            ]
        }
    }
}

Was this page helpful?