Create customers in bulk
curl --request POST \
--url https://platform.affelios.com/api/v1/customer/bulk \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
[
{
"externalId": "<string>",
"externalBrandId": "<string>",
"regDate": "<string>",
"clickKey": "<string>",
"externalProductId": "<string>",
"username": "<string>",
"country": "<string>",
"country_code": "<string>"
}
]
'import requests
url = "https://platform.affelios.com/api/v1/customer/bulk"
payload = [
{
"externalId": "<string>",
"externalBrandId": "<string>",
"regDate": "<string>",
"clickKey": "<string>",
"externalProductId": "<string>",
"username": "<string>",
"country": "<string>",
"country_code": "<string>"
}
]
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
externalId: '<string>',
externalBrandId: '<string>',
regDate: '<string>',
clickKey: '<string>',
externalProductId: '<string>',
username: '<string>',
country: '<string>',
country_code: '<string>'
}
])
};
fetch('https://platform.affelios.com/api/v1/customer/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://platform.affelios.com/api/v1/customer/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'externalId' => '<string>',
'externalBrandId' => '<string>',
'regDate' => '<string>',
'clickKey' => '<string>',
'externalProductId' => '<string>',
'username' => '<string>',
'country' => '<string>',
'country_code' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://platform.affelios.com/api/v1/customer/bulk"
payload := strings.NewReader("[\n {\n \"externalId\": \"<string>\",\n \"externalBrandId\": \"<string>\",\n \"regDate\": \"<string>\",\n \"clickKey\": \"<string>\",\n \"externalProductId\": \"<string>\",\n \"username\": \"<string>\",\n \"country\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://platform.affelios.com/api/v1/customer/bulk")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"externalId\": \"<string>\",\n \"externalBrandId\": \"<string>\",\n \"regDate\": \"<string>\",\n \"clickKey\": \"<string>\",\n \"externalProductId\": \"<string>\",\n \"username\": \"<string>\",\n \"country\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.affelios.com/api/v1/customer/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"externalId\": \"<string>\",\n \"externalBrandId\": \"<string>\",\n \"regDate\": \"<string>\",\n \"clickKey\": \"<string>\",\n \"externalProductId\": \"<string>\",\n \"username\": \"<string>\",\n \"country\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n]"
response = http.request(request)
puts response.read_body{
"numImported": 123,
"numDuplicates": 123,
"numFailed": 123,
"firstFailureId": "<string>",
"firstFailureMessage": "<string>"
}Customers
Create customers in bulk
Creates up to 1,000 customers in one request. Each customer is attributed the same way as
when you create one customer, but brands are identified by externalBrandId.
Customers without an externalId are skipped.
One failing customer doesn’t stop the others. Check the counts in the response, and
firstFailureMessage for the reason the first failure was rejected.
POST
/
api
/
v1
/
customer
/
bulk
Create customers in bulk
curl --request POST \
--url https://platform.affelios.com/api/v1/customer/bulk \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
[
{
"externalId": "<string>",
"externalBrandId": "<string>",
"regDate": "<string>",
"clickKey": "<string>",
"externalProductId": "<string>",
"username": "<string>",
"country": "<string>",
"country_code": "<string>"
}
]
'import requests
url = "https://platform.affelios.com/api/v1/customer/bulk"
payload = [
{
"externalId": "<string>",
"externalBrandId": "<string>",
"regDate": "<string>",
"clickKey": "<string>",
"externalProductId": "<string>",
"username": "<string>",
"country": "<string>",
"country_code": "<string>"
}
]
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
externalId: '<string>',
externalBrandId: '<string>',
regDate: '<string>',
clickKey: '<string>',
externalProductId: '<string>',
username: '<string>',
country: '<string>',
country_code: '<string>'
}
])
};
fetch('https://platform.affelios.com/api/v1/customer/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://platform.affelios.com/api/v1/customer/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'externalId' => '<string>',
'externalBrandId' => '<string>',
'regDate' => '<string>',
'clickKey' => '<string>',
'externalProductId' => '<string>',
'username' => '<string>',
'country' => '<string>',
'country_code' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://platform.affelios.com/api/v1/customer/bulk"
payload := strings.NewReader("[\n {\n \"externalId\": \"<string>\",\n \"externalBrandId\": \"<string>\",\n \"regDate\": \"<string>\",\n \"clickKey\": \"<string>\",\n \"externalProductId\": \"<string>\",\n \"username\": \"<string>\",\n \"country\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://platform.affelios.com/api/v1/customer/bulk")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"externalId\": \"<string>\",\n \"externalBrandId\": \"<string>\",\n \"regDate\": \"<string>\",\n \"clickKey\": \"<string>\",\n \"externalProductId\": \"<string>\",\n \"username\": \"<string>\",\n \"country\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.affelios.com/api/v1/customer/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"externalId\": \"<string>\",\n \"externalBrandId\": \"<string>\",\n \"regDate\": \"<string>\",\n \"clickKey\": \"<string>\",\n \"externalProductId\": \"<string>\",\n \"username\": \"<string>\",\n \"country\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n]"
response = http.request(request)
puts response.read_body{
"numImported": 123,
"numDuplicates": 123,
"numFailed": 123,
"firstFailureId": "<string>",
"firstFailureMessage": "<string>"
}Authorizations
Body
application/json
The customers to create, at most 1,000.
Response
How many customers were created, skipped as duplicates, or failed.
The result of creating or importing customers in bulk.