Back to Content Management API
articleUnpublish
Unpublishes article.
Arguments
- Name
id- Type
- ID!
- Description
The ID of the article you want to unpublish.
- Name
includeSections- Type
- [ID!]
- Description
Optional. By default, the article's sections stay published. Pass section IDs to unpublish those sections too.
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 {
nodes {
id
title
}
}
}
}
`;
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": {
"nodes": [
{
"id": "section-id-1",
"title": "Section Title"
}
]
}
}
}
}