Overview
You can use this request to update a specific customer’s properties. Use the customer’s ID to specify which customer to update, and submit the properties to update in a table.
The Method
| Type | Request | Method |
|---|---|---|
| REST | PUT | https://[Your URL]/api/2.0/customers/:id |
| XML-RPC | Call | GetCustomer |
Your URL is the address of your install.
Your method must be structured as follows:
UpdateCustomer(integer $id, \struct | array $properties) : int
Parameters
Required Parameters
You must specify the ID of the customer you want to update.
| Property | Type | Description | Required |
|---|---|---|---|
| $id | integer | The ID of the customer you need to update. | yes |
| $properties | structarray | The properties of the customer which need to be updated. Required properties are: hash name (See Properties table below for more details.) | yes |
Properties
You can update the following properties using this request:
| Property | Type | Description | Default | Required | Read Only |
|---|---|---|---|---|---|
| name | string | Name | empty | yes | no |
| status | string | Status Possible values: on / off / suspended / deleted | empty | no | no |
| string | empty | yes | no | ||
| email_package_id | integer | Package identifier | empty | no | no |
| email_quota | integer | Prepaid email quota | empty | no | no |
| sms_quota | integer | Prepaid SMS quota | empty | no | no |
| transactions_package_id | integer | Package Identifier | empty | no | no |
| transactions_quota | integer | Transactions prepaid quota. | empty | no | no |
| deleted | string | Customer deleted Possible values: yes / no | empty | no | no |
| address | string | Address | empty | no | no |
| state_provinces | string | State or Province | empty | no | no |
| postal_code | string | Postal or Zip code. | empty | no | no |
| telephone | string | Telephone number. | empty | no | no |
| website_url | string | Website URL. | empty | no | no |
| country | string | Two-character country code. | empty | no | no |
| industry | string | Customer industry. Possible values: Personal Use, Agriculture & Environmental, Automotive, Business & Consulting Services, E-commerce, Education & Training, Financial Institutions, Governmental Organisations, Hospitality, Travel & Tourism, Industry, Trade & Manufacture, Lifestyle, Arts & Entertainment, Logistic Services, Publishing & Media, Agencies & Marketing, Medical & Healthcare, Non Governmental Organisations, Property & Real Estate, Retail & Wholesale, Technology & Science. | empty | no | no |
| unique_id | string | Unique customer identifier. | empty | no | no |
Responses
| Type | Description |
|---|---|
| object | The properties of the created customer. |
Code Samples
PHP (using the REST API)
$json = '
{
"email":"[email protected]"
}
';
$url = '(Your URL)/api/2.0/customers/:customer_id;
$method = 'PUT';
$cSession = curl_init();
$headers = array();
$auth = base64_encode($username . ':' . $apikey);
$headers[] = 'Authorization: Basic ' . $auth;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, strtoupper($method));
curl_setopt($cSession, CURLOPT_POSTFIELDS, $json);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);