In this guide, you will learn how to create a Knowledge Base (KB) article with coauthor and contributor.
The TKBAuthor role must be assigned to you by the Administrator.
Requirements
- Open the Knowledge board where you want to create a KB article.
- Identify the ID of the KB board from the URL of the board as described in the Create a Forum.
- Ensure that you have the necessary permission to create the KB article granted by the Administrator.
- Create a POST request to create a KB article.
Example
In this example, we are going to create a KB article along with a coauthor and contributor on a KB board. You must use the contributionMethod
parameter and set it to EXPLICIT_ADD
to add a co-author and contributor. To remove the coauthor, you must set it to EXPLICIT_REMOVE
.
Here is a POST GraphQL Mutation request and response for the KB article.
GraphQL Mutation
mutation createTkbArticle($createInput: CreateTkbArticleInput!) {
createTkbArticle(createInput: $createInput) {
result {
id
subject
body
board {
id
creationId
creationDate
conversationStyle
}
contentWorkflow {
state
}
coAuthors {
totalCount
pageInfo {
hasPreviousPage
hasNextPage
}
edges {
node {
id
}
}
}
contributors {
totalCount
pageInfo {
hasPreviousPage
hasNextPage
}
edges {
node {
id
}
}
}
}
errors {
__typename
}
}
}
The variables accommodate the GraphQL Request.
GraphQL Variables
{
"createInput": {
"subject": "The Martyr's Curse",
"body": "A brief about a thriller based book.",
"teaser": "It talks about a ex-servicemen and his links to a treasure that was cursed.",
"introduction": "Cursed treasure unveiled by a man and the things in it.",
"board": {
"id": "board:jitiendran-kb"
},
"contentWorkflowAction": {
"workflowAction": "SAVE_DRAFT"
},
"coAuthors": [{
"user": {
"id": "user:5"
},
"contributionMethod": "EXPLICIT_ADD"
}],
"contributors": [{
"user": {
"id": "user:7"
},
"contributionMethod": "EXPLICIT_ADD"
}]
}
}
The response to the GraphQL request is given below.
GraphQL Response
{
"data": {
"createTkbArticle": {
"result": {
"id": "message:462",
"subject": "The Martyr's Curse",
"body": "A brief about a thriller based book.",
"board": {
"id": "board:jitiendran-kb",
"creationId": "52",
"creationDate": "2023-08-03T16:35:09.589+05:30",
"conversationStyle": "TKB"
},
"contentWorkflow": {
"state": "DRAFT"
},
"coAuthors": {
"totalCount": 32,
"pageInfo": {
"hasPreviousPage": false,
"hasNextPage": false
},
"edges": [
{
"node": {
"id": "user:5"
}
}
]
},
"contributors": {
"totalCount": 32,
"pageInfo": {
"hasPreviousPage": false,
"hasNextPage": false
},
"edges": [
{
"node": {
"id": "user:7"
}
}
]
}
},
"errors": null
}
}
}
ATLAS
Comments