addEntry
Adds a new entry to the calendar.
Route | /calendar/addEntry[/:key[/:format]] |
---|---|
required Parameters | datetimeStart (POST) title (POST) description (POST) eventType (POST) |
Optional Parameters | projhash (POST) datetimeEnd (POST) priority (POST) progress (POST) status (POST) format |
return values | hash |
cross references | getProjects() – contains projecthashes. |
hints | Dependency: The parameters priority, progress and status are considered only when the parameter eventType contains the value ‘todo’. POST: All parameters that are not in the route, are sended by POST. |
Parameters
labeling | description | valuemargin | default |
---|---|---|---|
projhash | Assignes a project to the entry. | see getProjects() | – |
format | Defines in what format the result will be returned. | json|xml | json |
datetimeStart | Startpoint | YYYY-MM-DD H:M:S | – |
datetimeEnd | Endpoint | YYYY-MM-DD H:M:S | – |
title | Title | string | – |
description | description | string | – |
eventType | Eventtype | note|todo|event | – |
priority | In case the eventtype is todo, you can set a priority. | urgent|high|normal|low | – |
progress | In case the eventtype is todo, you can define the procentual sate of the task. | 0 bis 100 | – |
status | In case the eventtype is todo, you can define the state of the task. | pending|processing|done | – |
Return values
labeling | description | valuemargin |
---|---|---|
hash | Id of the eventtype | string |
Messages
Message | Description |
---|---|
no permission | The key has no permission to access 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. |
Beispielcode
$root = 'https://suite.xovi.net/api/'; $arrayPath = array( 'service' =>'calendar', 'method' =>'addEntry', ); $pathString = implode('/', $arrayPath); $requestURL = $root.$pathString; //build POST query $arrayParams = array( 'description' => 'new Entry description', 'datetimeStart' => '2015-11-16 19:12:12', 'title' => 'new Entry', 'eventType' => 'note' ); $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; ?>
Beispielergebnisse
JSON
{ "apiErrorCode": 0, "apiErrorMessage": "0k.", "apiResult": [{ "hash": "b4b292d0c16f20eee10a7754539a189c" }] }
XML
<?xml version="1.0" encoding="UTF-8"?> <result> <apiErrorCode>0</apiErrorCode> <apiErrorMessage>0k.</apiErrorMessage> <apiResult> <entries> <entrie> <hash>3957d580698c3345c9a962e077c44961</hash> </entrie> </entries> </apiResult> </result>