addPerson

Adds a contact to the addressbook.

Route /addressbook/addPerson[/:key[/:format]]
required Parameters firstname (POST)
lastname (POST)
Optional Parameters 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)
socialGooglePlus (POST)
socialXing (POST)
format
return values  hash
cross references getProjects() – Diese Funktion enthält die Projekt Hashes.
getOrganisations()  – Diese Funktion enthält Organisation Hashes.
getLabels() – Diese Funktion enthält labelids.
hints
Alle Parameter, die nicht in der Route enthalten sind, werden per POST versendet.

Parameter

Labeling description value margin default value
titleprefix e.g. Dear Mister string
title Titel of the person. (e.g. Dr.) string
firstname Firstname of the person. string
lastname Lastname of the person. string
function Function of the person. string
birthday Birthday of the person. YYYY-MM-DD
costumernumber Costumernumber of the person. string
orghash Organisationhash string
description Description of the contact. string
labelids label ids array of strings
email primary E-Mail string
email2 secundary E-Mail string
phoneWork Telephonenumber string
phonePrivate Telephonenumber – privat string
phoneMobile Telephonenumber – mobile string
fax Faxnumber string
socialFacebook Facebook ID (from facebook.com/*Facebook-ID*) string
socialTwitter Twitter username (from twitter.com/*username*) string
socialLinkedin LinkedIn ID (from linkedin.com/in/*Linkedin-ID*) string
socialGooglePlus Google+ ID (from plus.google.com/*Google+-ID*) string
socialXing Xing username (from xing.com/profile/*username*) string
projhashes Projecthashes array of Projecthashes
format Defines of what format the result is. json|xml json

Return Values

Labeling Description value margin
hash Id of the person. (a-z0-9){32}

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.

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" encoding="UTF-8"?>
<result>
 <apiErrorCode>0</apiErrorCode>
 <apiErrorMessage>0k.</apiErrorMessage>
 <apiResult>
     <persons>
         <person>
             <hash>3957d580698c3345c9a962e077c44961</hash>
        </person>
     </persons>
 </apiResult>
</result>