You can create a basic blog article on a blog board or any blog board that you prefer.
In this guide, we create a blog article in a blog board.
Requirements
You must have the Start new posts permission set to Grant by Administrator.
Basic Steps
- Open the blog board where you want to create a blog article.
- Identify the ID of the blog board from the URL of the board as described in the Create a Forum.
- Ensure that you have the necessary permission to create the blog article granted by the Administrator.
- Create a POST request to create a blog article.
Example
Create a Blog Article
In this example, we are going to create a forum message in the Knight Riders board using a GraphQL query.
After you have created a blog message on the board, make sure you have received success as a response.
- Sign in to your community.
- Go to the Knight Rider board.
- Make a note of the ID of the board.
- Make a GraphQL POST request to the board.
The ID of the Klass Forum Board is knight-riders-board.
Here is the GraphQL POST request and response to create a blog article.
mutation createBlogArticle($createInput:CreateBlogArticleInput!) {
createBlogArticle(createInput: $createInput) {
result {
id
body
subject
introduction
teaser
contentWorkflow {
state
}
}
}
}
The mutation here initiates a createBlogArticle
function using information passed through GraphQL variables. Here is an example to create a blog article.
{
"createInput":{
"subject":"A trip to my hometown",
"body": "It's been long since I went to my native. This blog is about how I reached my native using my two-wheeler. A shocking incident which too before the start.",
"teaser": "Lushy and dense green trees in the way.",
"introduction": "A small trip to my native after a long time.",
"board":{
"id":"BOARD:knight-riders-board"
}
}
}
Here is the response to the above example.
{
"data": {
"createBlogArticle": {
"result": {
"id": "message:403",
"body": "It's been long since I went to my native. This blog is about how I reached my native using my two-wheeler. A shocking incident which too before the start.",
"subject":"A trip to my hometown",
"introduction": "A small trip to my native after a long time.",
"teaser": "Lushy and dense green trees in the way.",
"contentWorkflow": {
"state": "PUBLISH"
}
}
}
}
}
ATLAS
Comments