Informacje

Uwierzytelnianie wymagane
Format odpowiedzi json
Metoda HTTP POST

POST customers/:id/merge

Ostatnia modyfikacja 1970-01-02 01:00:00

Łączy (deduplikuje) klientów z klientem docelowym.

URL

https://your-system-name.thulium.com/api/customers/:id/merge

Parametry

id

wymagany

Identyfikator klienta docelowego (pozostaje po połączeniu). Przykładowa wartość: 123
customer_ids

wymagany

Lista identyfikatorów klientów wcielanych w docelowego i usuwanych. Muszą być tego samego typu (osoba/firma) co docelowy i nie mogą należeć do tej samej kampanii. Dane docelowego mają pierwszeństwo. Jeśli którykolwiek identyfikator jest błędny, żadne połączenie nie jest wykonywane. Przykładowa wartość: [124, 125]

Przykładowy request

POST https://your-system-name.thulium.com/api/customers/123/merge
Dane {"customer_ids":[124,125]}

Przykładowy response

{"customer_id":123,"merged_customer_ids":[124,125]}

Przykładowe wywołanie


PHP
<?php
$data = '{"customer_ids":[124,125]}';

$request = curl_init('https://your-system-name.thulium.com/api/customers/123/merge');
curl_setopt($request, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json; charset=utf-8',
    'Content-Length: ' . mb_strlen($data)
));
curl_setopt($request, CURLOPT_USERPWD, 'api_user:api_pass');
curl_setopt($request, CURLOPT_TIMEOUT, 30);
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($request, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($request, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($request);
if ($response) {
    $httpCode = curl_getinfo($request, CURLINFO_HTTP_CODE);
    if ($httpCode == 200){
        print_r(json_decode($response));
    } else {
        echo $response;
    }
} else {
    trigger_error(curl_error($request), E_USER_WARNING);
}

curl_close($request);
JAVA
public class Example {
    public static void main(String[] args) throws Exception {
        ThuliumRestClient restClient = new ThuliumRestClient("api_user", "api_pass", true);

        ThuliumRestClient.ThuliumRestResponse response = restClient.post("https://your-system-name.thulium.com/api/customers/123/merge", "{\"customer_ids\":[124,125]}");
        System.out.println(response);
    }
}

CURL
curl -u api_user:api_pass -k -X POST -H "Content-type: application/json" -d '{"customer_ids":[124,125]}' "https://your-system-name.thulium.com/api/customers/123/merge"

HTTPie
echo '{"customer_ids":[124,125]}' | http -a api_user:api_pass POST https://your-system-name.thulium.com/api/customers/123/merge