addPerson
Fügt eine Kontaktperson zum Adressbuch hinzu.
| Route | /addressbook/addPerson[/:key[/:format]] |
|---|---|
| Erforderliche Parameter | firstname (POST) lastname (POST) |
| Optionale Parameter | projhashes (POST) orghash (POST) labelids (POST) titleprefix (POST) title (POST) function (POST) birthday (POST) costumernumber (POST) description (POST) email (POST) email2 (POST) phoneWork (POST) phonePrivate (POST) phoneMobile (POST) fax (POST) socialFacebook (POST) socialTwitter (POST) socialLinkedin (POST) socialXing (POST) format |
| Rückgabewerte | hash |
| Querschnittverbindungen | getProjects() – Diese Funktion enthält die Projekt Hashes. getOrganisations() – Diese Funktion enthält Organisation Hashes. getLabels() – Diese Funktion enthält labelids. |
| Hinweise | Alle Parameter, die nicht in der Route enthalten sind, werden per POST versendet. |
Parameter
| Bezeichnung | Beschreibung | Wertebereich | Standardwert |
|---|---|---|---|
| titleprefix | Anrede in Brieftexten. (z.B. Sehr geehrter Herr) | string | – |
| title | Titel der Person. (z.B. Dr.) | string | – |
| firstname | Vorname der Person. | string | – |
| lastname | Nachname der Person. | string | – |
| function | Funktion der Person. | string | – |
| birthday | Geburtstag der Person. | YYYY-MM-DD | – |
| costumernumber | Kundennummer der Person. | string | – |
| orghash | Organisation Hash | string | – |
| description | Beschreibung des Kontaktes. | string | – |
| labelids | label ids | array of strings | – |
| Primäre E-Mail | string | – | |
| email2 | Sekundäre E-Mail | string | – |
| phoneWork | Telefonnummer | string | – |
| phonePrivate | Telefonnummer – privat | string | – |
| phoneMobile | Telefonnummer – mobile | string | – |
| fax | Faxnummer | string | – |
| socialFacebook | Facebook-ID (aus facebook.com/*Facebook-ID*) | string | – |
| socialTwitter | Twitter-Benutzername (aus twitter.com/*Benutzername*) | string | – |
| socialLinkedin | LinkedIn-ID (aus linkedin.com/in/*Linkedin-ID*) | string | – |
| socialXing | Xing-Benutzername (z.B. xing.com/profile/*Benutzername*) | string | – |
| projhashes | Projekt Hashes | array mit Projekthashes | – |
| format | Legt fest in welchem Format das Ergebnis zurückgeliefert werden soll. | json|xml | json |
Rückgabewerte
| Bezeichnung | Beschreibung | Wertebereich |
|---|---|---|
| hash | Id der Person | (a-z0-9){32} |
Meldungen
| Nachricht | Beschreibung |
|---|---|
| no permission | Der Schlüssel hat keinen Zugriff auf diese Funktion. |
| internal error | Ein interner Fehler ist aufgetreten. |
| param missing | Ein erforderlicher Parameter wurde nicht übergeben. |
| param invalid | Der Wert eines übergebenen Parameters ist nicht gültig. |
| result empty | Die Bearbeitung der Anfrage war erfolgreich, aber das Ergebnis ist leer. |
| cost error | Der aktuelle Kreditumfang reicht nicht aus, um die Anfrage zu bearbeiten. |
| 0k. | Die Bearbeitung der Anfrage war erfolgreich. |
Beispielcode
$root = 'https://suite.xovi.net/api/';
$arrayParams = array(
'service' => 'addressbook',
'method' => 'addPerson',
'key' => 'myPersonalKey',
);
$pathString = implode('/', $arrayParams);
$requestURL = $root.$pathString;
$arrayParams = array(
'firstname' => 'MyContactFirstname',
'lastname' => 'MyContactLastname',
);
$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"?>
<result>
<apiErrorCode>0</apiErrorCode>
<apiErrorMessage>0k.</apiErrorMessage>
<apiResult>
<persons>
<person>
<hash>3957d580698c3345c9a962e077c44961</hash>
</person>
</persons>
</apiResult>
</result>
