editOrganisation
Changes the values of an organisation in the addressbook.
| Route | /addressbook/editOrganisation[/:key[/:hash[/:format]]] |
|---|---|
| required Parameters | hash |
| Optional Parameters | name (POST) website (POST) description (POST) labelids (POST) billingStreet (POST) billingPobox (POST) billingCity (POST) billingState (POST) billingPostcode (POST) billingCountry (POST) deliveryStreet (POST) deliveryPobox (POST) deliveryCity (POST) deliveryState (POST) deliveryPostcode (POST) deliveryCountry (POST) format |
| return values | hash |
| cross references | getLabels() – to get available labelids getOrganisations() – to get the hashes of the existing organisations |
| Hints | – |
Parameters
| labeling | description | valuemargin | default |
|---|---|---|---|
| hash | hash of an existing organisation. | string | – |
| name | name | string | – |
| website | website | string | – |
| description | description | string | – |
| labelids | labelids | array | – |
| billingStreet | billing – Address | string | – |
| billingPobox | billing – Postbox | string | – |
| billingCity | billing – City | string | – |
| billingState | billing – State | string | – |
| billingPostcode | billing – Postcode | string | – |
| billingCountry | billing – country | string | – |
| deliveryStreet | delivery – Address | string | – |
| deliveryPobox | delivery – Postbox | string | – |
| deliveryCity | delivery – City | string | – |
| deliveryState | delivery – State | string | – |
| deliveryPostcode | delivery – Postcode | string | – |
| deliveryCountry | delivery – Country | string | – |
| format | Defines in what format the result will be returned. | json|xml | json |
Return values
| Labeling | description | value margin |
|---|---|---|
| hash | Id of the organisation | (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. |
Examplecode
$root = 'https://suite.xovi.net/api/';
$arrayParams = array(
'service' =>'addressbook',
'method' =>'editOrganisation',
'key' =>'myPersonalKey',
);
$pathString = implode('/', $arrayParams);
$requestURL = $root.$pathString;
$arrayParams = array(
'name' => 'MyOrganisation',
);
$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"
}]
}
[/php]
XML
<?xml version="1.0" encoding="UTF-8"?>
<result>
<apiErrorCode>0</apiErrorCode>
<apiErrorMessage>0k.</apiErrorMessage>
<apiResult>
<organisations>
<organisation>
<hash>3957d580698c3345c9a962e077c44961</hash>
</organisation>
</organisations>
</apiResult>
</result>
