Upload File to the Library
Last Modified on 09/09/2018 7:59 am MDT
PHP Example:
$ch=curl_init();
$callurl = "https://app.knowledgeowl.com/api/head/file.pson?_method=POST";
$postFields = array(
'_authbykey' => '{API Key}',
'file'=>'@{file path}',
'project_id' => '{Knowledge Base ID}',
'status' => 'active',
'name' => '{file name}'
);
curl_setopt($ch, CURLOPT_URL, $callurl);
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,$postFields);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$buffer = curl_exec($ch);
curl_close($ch);
$fileData = gzinflate($buffer);