Create an Article

REST Method: POST
URL: https://app.knowledgeowl.com/api/head/article.json

Accepted Fields

Name
Type
Required
Notes
project_id
Knowledge Base ID
True

statusStringTrue
Can be one of the following: 'ready', 'rejected', 'published', 'review', 'deleted'.
url_hashURL safe stringTrue
Permalinks (url_hash) must be lowercase and not include any illegal URL characters.
visibilityStringTrue
Can be either 'public' or 'custom'. Custom is used for articles restricted to reader groups.
nameStringTrue

current_versionString / HTMLTrue

toc_titleStringFalse
Shorter version of the title which will be displayed in the table of contents.
categoryCategory ID
False
ID of a category object.
application_screensArrayFalse
Used with the embeddable widgets to suggest articles based off of end-user's current URI. Example: ['/app/index', '/app/home']
modified_authorUser ID
False
ID of an admin user object.
indexIntFalse
The index order in which the article will be displayed within its container.
category_viewCategory ID
False
ID of a category object. If the category referenced is of type 'content', this article will be used as the category landing page.
prevent_searchingBooleanFalse
Omit this article from search results.
hide_from_tocBooleanFalse
Do not display this article in the table of contents.
remove_pdfBooleanFalse
Remove the download to PDF icon from this article.
remove_feedbackBooleanFalse
Remove the feedback / rating form for this article.
remove_commentsBooleanFalse
Remove the ability to comment from this article.
calloutStringFalse
Can be one of the following: 'new', 'updated'.
callout_expireUnix UTC TimestampFalse
Callouts will be ignored if callout_expire is null or the current date is past the callout_expire date.
callout_videoBooleanFalse
Callout to indicate the article contains a video.
reader_rolesArrayFalse
Array of unique IDs referencing reader_roles objects. Article viewing will be restricted to those reader groups.
related_articlesArrayFalse
Array of article IDs that will be shown as related.
authorUser ID
False
Unique ID referencing an agent object.
user_teamsArrayFalse
Array of user team IDs to restrict this article to.
tagsArrayFalse
Array of article tag IDs.
search_phrasesArrayFalse
Array of lowercase phrases that when searched will pull this article up first.

PHP Example

// [[ ]] Denotes an element you need to replace 
$endpoint = 'https://app.knowledgeowl.com/api/head/article.json';

//base data you will most likely be using for all calls
$stdData = array(
    _authbykey => '[[API KEY]]', 
    project_id => '[[Knowledge Base ID]]'
  );

$artData = $stdData;
  
/** ----------- REQUIRED FIELDS ----------- */
//article title
$artData["name"] = "Testing";
//'public', or 'custom'
$artData["visibility"] = 'public'; 
//'draft', 'ready', 'rejected', 'published', 'review', 'deleted'
$artData["status"] = 'published'; 
//Unique name used to locate this article and to give a permanent link
$artData["url_hash"] = '[[string]]'; 

/** ----------- OPTIONAL FIELDS ----------- */
//"Alternate title for the table of contents",
$artData["toc_title"] = '[[string]]';
//Category ID that you want to create the article in"
$artData["category"] = '[[Category ID]]';
//used to weight suggestions for applicable screens
$artData["application_screens"] = ['[[URI]]', '[[URI]]'];
//determines the order articles appear in the TOC
$artData["index"] = [[int]];
//you can attach any article to a "Custom Content" category
$artData["category_view"] = '[[Category ID]]';
//never include this article in search results
$artData["prevent_searching"] = [[boolean]];
//do not display article in the table of contents
$artData["hide_from_toc"] = [[boolean]];
//do not display the "Download to PDF" icon
$artData["remove_pdf"]	= [[boolean]];
//set a callout flag ('new', or 'updated')
$artData["callout"] = '[[string]]';
//when should the callout expire
$artData["callout_expire"]	= [[timestamp]];
//callout of video content
$artData["callout_video"] = [[boolean];
//Array of custom reader roles that can access this article
$artData["reader_roles"] = ['[[Reader Group ID]]', '[[Reader Group ID]]'];
									
//add the actual content of the article like so
$artData["current_version"] = array (
  	"en" => array (
	  	text => '[[HTML]]',
		title => '[[string]]'
  	)
  );

//POST the article
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_NOPROGRESS, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$artData);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$buffer = curl_exec($ch);
curl_close($ch);