Updating and publishing an article with API allows you to automate the authoring process. Three steps are involved in updating an article:
Fork the article
Update the article content
Publish the article
Fork the article
Under v2, expand Articles → {article Id} and click Forks an article with an ID
In the Params tab, you can find the Path variables section
In the 'Value' field of articleId, paste the desired article id
Navigate to the Body tab in the main window
You can find the below parameters:
lang_code - Add the desired language code. Language code is filled as 'en' by default
user_id - Add the desired user id
version_number - Add the desired version number you want to fork
For example, If you want to create an article version by forking version 3, mention the 'version_number' as 3
How to find the versions of an article?
a. Under v2, expand Articles → {article Id} → {lang Code} → versions and click Get all article versions
b. In the Params tab, you can find the Path variables section
c. In the 'Value' field of articleId and langCode, enter the desired article id and language code
d. Click Send
e. All the versions of that article appears in the Response sectionClick Send and the desired article version is created
Update the article
Under v2, expand Articles → {article Id} → {lang Code} → settings and click Updates an article with the ID
In the Params tab, you can find the Path variables section
In the 'Value' field of articleId, paste the desired article id
In the 'Value' field of langCode, type in the desired language code. Language code is filled as 'en' by default
Navigate to the Body tab in the main window
You can find the below parameters:
title, content/html_content, category_id, and version_number are mandatory parameters.title - Add the desired article title
content - Add the desired article markdown content. If the editor type is Markdown, update here. If the article is in the WYSIWYG editor, remove this parameter.
html_content - Add the desired HTML content. If the editor type is WYSIWYG, update here. If the article is in the Markdown editor, remove this parameter.
category_id - Paste the desired category id
hidden - Hide/Show article
version_number - Add the desired article version you want to update
translation_option - Mention the translation status of the article. 0 - None, 1 - Needs translation, 2 - Translated
source - Mention any free text. It can be used for future reference
Remove the parameters you do not want to update
The parameter values in this tab are updated for the respective settings in the article. If the unwanted parameters are not removed, the unwanted parameters also get updated.
Click Send
The article changes are updated successfully. You can verify this with the 200 OK status and success parameter value as true
Publish the article
To publish an article, you need the following values:
Article id
User id
Under v2, expand Articles → {article Id} and click Publishes an article with an id
In the Params tab, you can find the Path variables section
In the 'Value' field of articleId, paste the desired article id
Navigate to the Body tab in the main window
You can find the below parameters:
user_id - Paste the desired user id
version_number - Add the desired article version number
publish_message - Add the desired publish message for the article
Click Send
The desired article is published successfully. You can verify this with the 200 OK status and success parameter value as true