Back to Content Management API
blogPublish
Publishes a blog.
Arguments
- Name
id
- Type
- ID!
- Description
The ID of the blog you want to publish.
- Name
publishComment
- Type
- String
- Description
An optional string to comment on the blog publish.
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 BlogPublish($id: ID!, $publishComment: String) {
blogPublish(id: $id, publishComment: $publishComment) {
id
title
handle
description
}
}
`;
const variables = {
id: 'YOUR-BLOG-ID',
publishComment: 'YOUR-PUBLISH-COMMENT'
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"blogPublish": {
"id": "blog-id-1",
"title": "Blog Title",
"handle": "blog-title",
"description": "Blog Description"
}
}
}