addProject

Adds a project.

Route /project/addProject[/:key[/:name[/:domain[/:description[/:format]]]]]
Necessary parameter name
domain
Optional parameter description
format
competitors (POST)
Return values hash
name
Cross references

Parameter

Labeling Description Values margin
name Contains the name of the project. (A-Z|a-z)+
domain Contains a domain the project is assigned to. (A-Z|a-z)+
competitors Contains an array with competitors. (send via POST) see example

Return values

Labeling Description Values margin
hash Contains a unique identifier. (0-9|a-z)+
name Contains a designator for the already created project. (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.

Exemplary code

$root = 'https://suite.xovi.net/api/';

$arrayPath = array(
    'service' =>'project',
    'method' =>'addProject',
    'key' =>'myApiKey',
    'name' => 'fromApi',
    'domain' => 'www.xovi.de',
    'format' => 'json',
);
$pathString = implode('/', $arrayPath);
$requestURL = $root.$pathString;

//build POST query
$arrayParams = array(
       'competitors' => array('www.competitor1.de', 'www.competitor2.com'),
);
$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":[
        {
            "hash":32376,
            "name":"apiproject"
        }]
}

XML

<?xml version="1.0"?>
<result>
    <apiErrorCode>0</apiErrorCode>
    <apiErrorMessage>0k.</apiErrorMessage>
    <apiResult>
        <projects>
            <project>
                <hash>32376</hash>
                <name>apiproject</name>
            </project>
        </projects>
    </apiResult>
</result>