editLabel
Edits a label.
| Route | /project/editLabel[/:key[/:hash[/:name[/:format]]]] |
|---|---|
| required Parameter | hash |
| Optional Parameter | name categories (POST) format |
| returnvalues | hash |
| crossrefferences | getLabels() – contains hashes of the labels. getCategories() – contains possible categories. |
| hints | categories – If categories are passed, the available assignements will be discarded. The send categories will be assigend to the label. POST – Variables should be UTF-8 encoded. |
Parameter
| labeling | description | valemargin | defaultvalue |
|---|---|---|---|
| format | Legt fest in welchem Format das Ergebnis zurückgeliefert werden soll. | json|xml | json |
| hash | Id of the label. | string | – |
| name | name of the label | string | available name |
| categories | Array with categories which the label should be assigned to. | array | available assignements |
Returnvalues
| labeling | description | valuemargin |
|---|---|---|
| hash | Id of the label | (a-z0-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. |
| value 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. |
Examplecode
$root = 'https://suite.xovi.net/api/';
$arrayPath = array(
'service' =>'project',
'method' =>'editLabel',
'key' => 'myKey',
'hash' => 'hashOfLabel',
'name' => 'nameChanged',
);
$pathString = implode('/', $arrayPath);
$requestURL = $root.$pathString;
$arrayParams = array(
'categories' => array(
'keywords'
)
);
$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);
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
echo $output;
Exampleresults
JSON
{
"apiErrorCode": 0,
"apiErrorMessage": "0k.",
"apiResult": [{
"hash": "b4b292d0c16f2"
}]
}
XML
<?xml version="1.0" encoding="UTF-8"?>
<result>
<apiErrorCode>0</apiErrorCode>
<apiErrorMessage>0k.</apiErrorMessage>
<apiResult>
<entries>
<entrie>
<hash>b4b292d0c16f2</hash>
</entrie>
</entries>
</apiResult>
</result>
