addKeywords
Adds keywords to Monitoring.
| Route | /monitor/addKeywords[/:key[/:format]] |
|---|---|
| Required Parameters | projhash domains searchengines devices checkdays keywords |
| Optional Parameters | ignoreUSearch createNote date labelids |
| return values | name |
| cross references | getProjects (projhash, domains) getSearchengines (serchengines) getLabels (labelids) |
| hints | Paramters not included in the route are sent by POST |
Parameter
| labeling | Description | values margin | default values |
|---|---|---|---|
| projhash | Contains a project-hash. (see getProjects) | (a-z|0-9){32} | – |
| domains | Contains an array with domain-hashes. (see getProjects) | (a-z|0-9)+ | – |
| searchengines | Contains an array with searchengine-ids. (siehe getSearchengines) | (0-9)+ | – |
| devices | Contains an array with device-ids. |
1 – PC 2 – Tablet 3 – Handy |
– |
| checkdays | Contains an array with days on which crawling is due to take place. | (mo|tu|we|th|fr|sa|su) | – |
| keywords |
Contains an array with keywords which should be crawled. | (A-Z|a-z|0-9)+ | – |
| ignoreUSearch | Activtes ignoreUSearch. | true (if value not set, it corresponds to a false) | false |
| createNote | Sent to the XOVI calendar. | true (if value not set, it corresponds to a false) | false |
| date | Date on which crawling shall begin. | YYYY-MM-DD | immediately |
| labelids | Contains a range of labels which can be assigned to the crawl.Labels can only be assigned to the ‚keywords‘ category. (See getLabels) | (a-z|0-9)+ | – |
Return Values
| labeling | description | values margin |
|---|---|---|
| name | Contains the names of the added Keywords. | (A-Z|a-z|0-9)+ |
Messages
| Message | Description |
|---|---|
| no permission | The key has no access to this function. |
| internal error | An internal error occured. |
| param missing | A required parameter is missing. |
| param invalid | The value of a parameter is not valid. |
| result empty | The request was successful, but the result itself is empty. |
| cost error | The current credit amount is not sufficient to handle the request. |
| 0k. | The processing was successful. |
| crawl limit reached | No more keywords can be added. You don’t have sufficient credits. |
Exemplary Code
$root = 'https://suite.xovi.net/api/';
$arrayPath = array(
'service' =>'keywords',
'method' =>'addMonitoringKeywords',
'key' =>'myApiKey',
'format' => 'json',
);
$pathString = implode('/', $arrayPath);
$requestURL = $root.$pathString;
//build POST query
$arrayParams = array(
'projhash' => '1234567bafc4295231f897911fb44731',
'domains' => array('123456708a6843e0'),
'searchengines' => array(1),
'devices' => array( 1, 2),
'checkdays' => array( 'mo', 'tu'),
'keywords' => array ( 'myKeyword'),
'date' => '2999-12-12',
'labelids' => Array
(
0 => 'asdfkaaa',
1 => 'asdfkbbb'
)
);
$paramsString = http_build_query($arrayParams);
if (!function_exists('curl_init')) die('cURL not available');
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_URL, $requestURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//setup POST
curl_setopt($ch,CURLOPT_POST, count($arrayParams));
curl_setopt($ch,CURLOPT_POSTFIELDS, $paramsString);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
Exemplary Results
JSON
{
"apiErrorCode":0,
"apiErrorMessage":"0k.",
"apiResult":[
{
"name":"myKeyword"
}]
}
XML
<?xml version="1.0"?>
<result>
<apiErrorCode>0</apiErrorCode>
<apiErrorMessage>0k.</apiErrorMessage>
<apiResult>
<projects>
<project>
<name>myKeyword</name>
</project>
</projects>
</apiResult>
</result>
