Update Source
The Update Source method allows you to update the contact source.
Request
IMPORTANT: Do not send more than 10 concurrent API requests.
Body Example
                                        {
"source": "sourceId or customerSourceId",
"name": "SourceName",
"customerSourceId": "myNewSourceID",
"cac": {
          "value": 2.05,
          "currency": "EUR" 
        }
}
                                    
                                Parameters
| Title | Type | Default | Description | 
|---|---|---|---|
| source required | string | Unique customerSourceId or sourceId that is already registered in Wooxy system. | |
| name optional | string | Name of your contact source | |
| customerSourcceId optional | string | New unique customerSourceId that is already registered in your system. | |
| cac optional | object | null | An object that contains comprehensive data regarding the cost of acquiring customers comprises the value and currency. | 
| cac.value required | string | CAC value in  | |
| cac.currency required | string | (EUR, USD) | 
Response
                                        {
    "result": true
}
                                    
                                Parameters
| Title | Type | Description | 
|---|---|---|
| result | boolean | The value indicates that the source was successfully updated in your account: 
 | 
Method Errors
                                        {
   "result":false,
   "errors":[
      "Error description text"
   ]
}
                                    
                                    | Error | 
|---|
| “Argument ‘source’ must be a non-empty string: ID or customerSourceId of updating instance” | 
| “Argument ‘name’ must be a non-empty string with max length 150 chars” | 
| “Argument ‘customerSourceId’ must be an alphanumeric string with max length 40 chars” | 
| “Argument CAC must be an array with value and currency fields” | 
| “CAC value must be a positive float” | 
| “CAC currency {currency} not allowed. USD, EUR are” | 
| “Argument ‘source’ required”,”Contact source {source} not found in your account” | 
| “Contact source with this parameters is already registered” | 
| “Invalid authorization token!” | 
| “Internal server error” | 
| “Bad Request” | 
| “no matches found for access token {accessToken}” | 
| “user {id} not enabled” | 
| “access token check failed for key\/secret $key\/$accessToken” | 
| “Argument {argument} required” | 
| “no data found for key {userId}” | 
Code Examples
                $accessToken = 'YOUR_API_KEY';
$url         = 'https://api.wooxy.com/v3/contact-source/update';
$body = json_encode([
    'source'           => 'sourceId or customerSourceId',                     
    'name'             => 'SourceName',
    'customerSourceId' => 'myNewSourceID', 
    'cac'              => [       
        'value'    => 2.05,
        'currency' => 'USD',
    ],
]);
/**
 * Request Example
 */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_INFILESIZE, null);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Access-Token: $accessToken",
    'Content-Type: application/json',
    'Content-Length: ' . strlen($body),
]);
$result = curl_exec($ch);
if ($result === false) {
    echo 'cURL error:' . curl_error($ch) . PHP_EOL;
} else {
    echo strval($result) . PHP_EOL;
}
curl_close($ch);