How to create the knowledge article version using REST API

Komal26
Kilo Contributor

I have knowledge article in knowledgebase. Now I have to create another updated version of that article using REST API. I couldn't find any option for this.

2 REPLIES 2

Tim88
Kilo Contributor

ServiceNow stores the HTML data of a KB article in the text field of the kb_knowledge table record for your article. You could GET the current version, make your updates and then use a PUT request to write the updated article.

There are issues you'd have to deal with though:

1. The publish workflow

2. If you've got the KB advanced plugin installed, you'd have to manipulate the version tables too.

Tim88
Kilo Contributor

Actually, I've just tried this, and on a KB with instant publish, the article gets updated immediately - no publish required. 

Another gotcha is that you have to unencode the HTML before you PUT it back. So remove all \n and \t strings, change all \\ to \, and change all \" to "