Newer Version Available
Knowledge Actions
The Assign and Publish actions are available in API version 44.0 and later. All the other actions are available in API version 45.0 and later.
Lightning Knowledge must be set up in your org. The user must have permissions to manage articles.
Supported REST HTTP Methods
- URIs
- Archive Knowledge articles:
- /services/data/vXX.X/actions/standard/archiveKnowledgeArticles
- Assign Knowledge articles:
- /services/data/vXX.X/actions/standard/assignKnowledgeArticles
- Create draft from online Knowledge articles:
- /services/data/vXX.X/actions/standard/createDraftFromOnlineKnowledgeArticle
- Delete Knowledge articles:
- /services/data/vXX.X/actions/standard/deleteKnowledgeArticles
- Publish Knowledge articles:
- /services/data/vXX.X/actions/standard/publishKnowledgeArticles
- Restore Knowledge article version:
- /services/data/vXX.X/actions/standard/restoreKnowledgeArticleVersion
- Retrieve Smart Link URL:
- /services/data/vXX.X/actions/standard/getArticleSmartLinkUrl
- Submit Knowledge article for translation:
- /services/data/vXX.X/actions/standard/submitKnowledgeArticleForTranslation
- Formats
- JSON, XML
- HTTP Methods
- GET, HEAD, POST
- Authentication
- Authorization: Bearer token
- Other Information
- Error Response Types
Archive Knowledge Articles
URI: /services/data/vXX.X/actions/standard/archiveKnowledgeArticles
| Input | Details |
|---|---|
| articleVersionIdList |
|
- Sample Input
-
The following code sample archives two articles:
1{ 2 "inputs" : [ 3 { 4 "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ] 5 } 6 ] 7} - Sample Output
-
The following code sample illustrates a response after a successful request.
1[ { 2 "actionName" : "archiveKnowledgeArticles", 3 "errors" : null, 4 "isSuccess" : true, 5 "outputValues" : { 6 "ka0RM00000004Ve" : "Success", 7 "ka0RM00000003do" : "Success" 8 } 9} ] -
The following code sample illustrates a response with one success and one failure:
1[ { 2 "actionName" : "archiveKnowledgeArticles", 3 "errors" : null, 4 "isSuccess" : false, 5 "outputValues" : { 6 "ka0RM00000004Ve" : "You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.", 7 "ka0RM00000003do" : "Success" 8 } 9} ]
Assign Knowledge Articles
URI: /services/data/vXX.X/actions/standard/assignKnowledgeArticles
| Input | Details |
|---|---|
| articleVersionIdList |
|
| assigneeId |
|
| assignAction |
|
| dueDate |
|
| instruction |
|
| sendEmailNotification |
|
- Sample Input
-
The following code sample assigns two articles for translation:
1{ 2 "inputs" : [ 3 { 4 "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ] 5 "assigneeId" : "005RM00000AAAAAYA4", 6 "assignAction" : "ASSIGN_DRAFT_TRANSLATION" 7 } 8 ] 9} - Sample Output
-
The following code sample illustrates a response after a successful request.
1[ { 2 "actionName" : "assignKnowledgeArticles", 3 "errors" : null, 4 "isSuccess" : true, 5 "outputValues" : { 6 "ka0RM00000004Ve" : "Success", 7 "ka0RM00000003do" : "Success" 8 } 9} ]
Create Draft from Online Knowledge Article
URI: /services/data/vXX.X/actions/standard/createDraftFromOnlineKnowledgeArticle
| Input | Details |
|---|---|
| action |
|
| unpublish |
|
| articleVersionId |
|
| articleId |
|
- Sample Input
-
The following code sample creates a draft from a master article and archives the original article:
1{ 2 "inputs" : [ 3 { 4 "action" : "EDIT_AS_DRAFT_ARTICLE", 5 "unpublish" : true, 6 "articleId" : "kA0RM00000004pP0AQ" 7 } 8 ] 9} - Sample Output
-
The following code sample illustrates a response after a successful request.
1[ { 2 "actionName" : "createDraftFromOnlineKnowledgeArticle", 3 "errors" : null, 4 "isSuccess" : true, 5 "outputValues" : { 6 "kA0RM00000004pP0AQ" : "Success" 7 } 8} ]
Delete Knowledge Articles
URI: /services/data/vXX.X/actions/standard/deleteKnowledgeArticles
| Input | Details |
|---|---|
| articleVersionIdList |
|
- Sample Input
-
The following code sample deletes two articles:
1{ 2 "inputs" : [ 3 { 4 "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ] 5 } 6 ] 7} - Sample Output
-
The following code sample illustrates a response after a successful request.
1[ { 2 "actionName" : "deleteKnowledgeArticles", 3 "errors" : null, 4 "isSuccess" : true, 5 "outputValues" : { 6 "ka0RM00000004Ve" : "Success", 7 "ka0RM00000003do" : "Success" 8 } 9} ]
Publish Knowledge Articles
URI: /services/data/vXX.X/actions/standard/publishKnowledgeArticles
| Input | Details |
|---|---|
| articleVersionIdList |
|
| pubAction |
|
| pubDate |
|
- Sample Input
-
The following code sample publishes two articles:
1{ 2 "inputs" : [ 3 { 4 "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ], 5 "pubAction" : "PUBLISH_ARTICLE" 6 } 7 ] 8} - Sample Output
-
The following code sample illustrates a response after a successful request.
1[ { 2 "actionName" : "publishKnowledgeArticles", 3 "errors" : null, 4 "isSuccess" : true, 5 "outputValues" : { 6 "ka0RM00000004Ve" : "Success", 7 "ka0RM00000003do" : "Success" 8 } 9} ]
Restore Knowledge Article Version
URI: /services/data/vXX.X/actions/standard/restoreKnowledgeArticleVersion
| Input | Details |
|---|---|
| action |
|
| articleId |
|
| versionNumber |
|
- Sample Input
-
The following code restores the latest archived version:
1{ 2 "inputs" : [ 3 { 4 "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION", 5 "articleId" : "kA0RM00000004pP0AQ" 6 } 7 ] 8} -
The following code restores a past archived version of a published article:
1{ 2 "inputs" : [ 3 { 4 "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION", 5 "versionNumber":3, 6 "articleId" : "kA0RM00000004pP0AQ" 7 } 8 ] 9} -
The following code restores two archived articles:
1{ 2 "inputs" : [ 3 { 4 "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION", 5 "articleId" : "kA0RM00000004pP0AQ" 6 }, 7 { 8 "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION", 9 "articleId" : "kA0RM00000004pP0AB" 10 } 11 ] 12} - Sample Output
-
The following code sample illustrates a response after a successful request.
1[ { 2 "actionName" : "restoreKnowledgeArticleVersion", 3 "errors" : null, 4 "isSuccess" : true, 5 "outputValues" : { 6 "kA0RM00000004pP0AQ" : "Success" 7 } 8} ]
Retrieve Smart Link URL
URI: /services/data/vXX.X/actions/standard/getArticleSmartLinkUrl
| Input | Details |
|---|---|
| articleVersionId |
|
- Sample Input
-
The following code sample retrieves the SmartLink URL of a Knowledge article version:
1{ 2 "inputs":[ 3 { 4 "articleVersionId":"ka0xx00000000cjAAA" 5 } 6 ] 7} - Sample Output
-
The following code sample illustrates a response after a successful request.
1[ 2 { 3 "actionName":"getArticleSmartLinkUrl", 4 "errors":null, 5 "isSuccess":true, 6 "outputValues":{ 7 "articleSmartLinkUrl":"https://example.lightning.force.com/lightning/articles/Knowledge/Test-Redirection-1" 8 } 9 } 10]
Submit Knowledge Article for Translation
URI: /services/data/vXX.X/actions/standard/submitKnowledgeArticleForTranslation
| Input | Details |
|---|---|
| articleId |
|
| language |
|
| assigneeId |
|
| dueDate |
|
| sendEmailNotification |
|
| Output | Details |
|---|---|
| articleId |
|
| language |
|
- Sample Input
-
The following code sample submits one article for translation into Spanish:
1{ 2 "inputs" : [ 3 { 4 "articleId" : "kA0RM00000004pP0AQ", 5 "language" : "es", 6 "assigneeId" : "005RM00000AAAAAYA4" 7 } 8 ] 9} - Sample Output
-
The following code sample illustrates a response after a successful request.
1[ { 2 "actionName" : "submitKnowledgeArticleForTranslation", 3 "errors" : null, 4 "isSuccess" : true, 5 "outputValues" : { 6 "articleId" : "kA0RM00000004pP0AQ", 7 "language" : "es" 8 } 9} ]
Error Response Types
Knowledge actions can respond with two types of error responses: action-scoped errors and item-scoped errors.
Action-scoped errors describe an error about the overall action that you’re trying to invoke. Action-scoped errors have a statusCode in addition to a message. This example illustrates an action-scoped error caused by sending invalid input values.
1[ {
2 "actionName" : "restoreKnowledgeArticleVersion",
3 "errors" : [ {
4 "statusCode" : "INVALID_API_INPUT",
5 "message" : "You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.",
6 "fields" : [ ]
7 } ],
8 "isSuccess" : false,
9 "outputValues" : null
10 } ]Item-scoped errors describe a problem with a specific article or article version within the action. For example, this code illustrates an archiveKnowledgeArticles action response with one failed item and one successful item.
1[ {
2 "actionName" : "archiveKnowledgeArticles",
3 "errors" : null,
4 "isSuccess" : false,
5 "outputValues" : {
6 "ka0RM00000004Ve" : "You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.",
7 "ka0RM00000003do" : "Success"
8 }
9 } ]If any type of error occurs with an action, the isSuccess field is false.