Overview
You can use this request to change the email package a customer is on.
The Method
API | - | Method |
---|---|---|
REST | POST | https://[Your URL]/api/2.0/customers/change_email_package/:customer_id/:package_identifier |
Parameters
Required Parameters
The following parameters must be included for this method to work:
Property | Type | Description | Default | Required |
---|---|---|---|---|
$id | integer | ID of the customer to change the package of. | none | yes |
$package_id | string | Identifier for the package to change the customer to. | none | yes |
Example Request
<?php $username = 'administrator'; $apiKey = '7IjRKva9OzwCsy9xaCwsihA6HxUTwE7a_999'; $localUrl = 'https://localhost'; $customerId = 1; $packageIdentifier = 1; $url = $localUrl . '/api/2.0/customers/change_email_package/' . $customerId . '/' . $packageIdentifier; $method = 'POST'; $auth = base64_encode($username . ':' . $apiKey); $cSession = curl_init(); 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, '{}'); curl_setopt($cSession, CURLOPT_HTTPHEADER, [ 'Authorization: Basic ' . $auth, 'Content-Type: application/json' ]); $response = curl_exec($cSession); var_dump($response); curl_close($cSession);
Example Response
{ "links":[ { "title":"Self", "rel":"self", "href":"http:\/\/localhost\/api\/2.0\/customers\/change_email_package\/1\/1" }, { "title":"Home", "rel":"home", "href":"http:\/\/localhost\/api\/2.0\/" } ], "item":{ "id":1, "enterprise_id":1, "hash":"7kvwQz6dzkgKbjS8", "country_code":"ZA", "is_department":"no", "name":"Administrator Customer", "status":"on", "address":"4th Floor Rosebank Corner", "state_provinces":"Gauteng", "postal_code":"2121", "telephone":"+27 11 447 6147", "fax":"+27 11 880 0340", "email":"[email protected]", "industry":"E-commerce", "website_url":"", "country":"ZA", "email_package_id":1, "email_quota":0, "sms_quota":10, "push_package_id":110, "transactions_package_id":0, "transactions_quota":0, "deleted":"no" } }