curl --request POST \
--url https://prod01.copilot.fabric.inc/data-subscription/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customerReferenceId": "12345",
"locale": "en_US",
"email": "customer@example.com",
"firstName": "Pat",
"lastName": "Kake",
"communicationPreference": {
"email": true,
"sms": true
},
"contactnumber": "+923333709568",
"middleName": "E",
"segment": [
"employee"
],
"employeeId": "345"
}
'import requests
url = "https://prod01.copilot.fabric.inc/data-subscription/v1/customers"
payload = {
"customerReferenceId": "12345",
"locale": "en_US",
"email": "customer@example.com",
"firstName": "Pat",
"lastName": "Kake",
"communicationPreference": {
"email": True,
"sms": True
},
"contactnumber": "+923333709568",
"middleName": "E",
"segment": ["employee"],
"employeeId": "345"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerReferenceId: '12345',
locale: 'en_US',
email: 'customer@example.com',
firstName: 'Pat',
lastName: 'Kake',
communicationPreference: {email: true, sms: true},
contactnumber: '+923333709568',
middleName: 'E',
segment: ['employee'],
employeeId: '345'
})
};
fetch('https://prod01.copilot.fabric.inc/data-subscription/v1/customers', 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://prod01.copilot.fabric.inc/data-subscription/v1/customers",
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([
'customerReferenceId' => '12345',
'locale' => 'en_US',
'email' => 'customer@example.com',
'firstName' => 'Pat',
'lastName' => 'Kake',
'communicationPreference' => [
'email' => true,
'sms' => true
],
'contactnumber' => '+923333709568',
'middleName' => 'E',
'segment' => [
'employee'
],
'employeeId' => '345'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://prod01.copilot.fabric.inc/data-subscription/v1/customers"
payload := strings.NewReader("{\n \"customerReferenceId\": \"12345\",\n \"locale\": \"en_US\",\n \"email\": \"customer@example.com\",\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"communicationPreference\": {\n \"email\": true,\n \"sms\": true\n },\n \"contactnumber\": \"+923333709568\",\n \"middleName\": \"E\",\n \"segment\": [\n \"employee\"\n ],\n \"employeeId\": \"345\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://prod01.copilot.fabric.inc/data-subscription/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customerReferenceId\": \"12345\",\n \"locale\": \"en_US\",\n \"email\": \"customer@example.com\",\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"communicationPreference\": {\n \"email\": true,\n \"sms\": true\n },\n \"contactnumber\": \"+923333709568\",\n \"middleName\": \"E\",\n \"segment\": [\n \"employee\"\n ],\n \"employeeId\": \"345\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod01.copilot.fabric.inc/data-subscription/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerReferenceId\": \"12345\",\n \"locale\": \"en_US\",\n \"email\": \"customer@example.com\",\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"communicationPreference\": {\n \"email\": true,\n \"sms\": true\n },\n \"contactnumber\": \"+923333709568\",\n \"middleName\": \"E\",\n \"segment\": [\n \"employee\"\n ],\n \"employeeId\": \"345\"\n}"
response = http.request(request)
puts response.read_body{
"id": "62cffd65e8d7eb868c6a29d6",
"customerReferenceId": "12345",
"locale": "en_US",
"email": "customer@example.com",
"contactNumber": "+923333709568",
"firstName": "Pat",
"middleName": "E",
"lastName": "Kake",
"segment": [
"employee"
],
"employeeId": "345",
"communicationPreference": {
"email": true,
"sms": true
},
"status": "ACTIVE",
"createdAt": "2021-10-12T21:35:05.756Z",
"updatedAt": "2021-10-14T05:40:55.997Z"
}{
"responseStatus": "BAD_REQUEST",
"message": "Bad request"
}Create subscriber
Create new subscriber with specified details
curl --request POST \
--url https://prod01.copilot.fabric.inc/data-subscription/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customerReferenceId": "12345",
"locale": "en_US",
"email": "customer@example.com",
"firstName": "Pat",
"lastName": "Kake",
"communicationPreference": {
"email": true,
"sms": true
},
"contactnumber": "+923333709568",
"middleName": "E",
"segment": [
"employee"
],
"employeeId": "345"
}
'import requests
url = "https://prod01.copilot.fabric.inc/data-subscription/v1/customers"
payload = {
"customerReferenceId": "12345",
"locale": "en_US",
"email": "customer@example.com",
"firstName": "Pat",
"lastName": "Kake",
"communicationPreference": {
"email": True,
"sms": True
},
"contactnumber": "+923333709568",
"middleName": "E",
"segment": ["employee"],
"employeeId": "345"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerReferenceId: '12345',
locale: 'en_US',
email: 'customer@example.com',
firstName: 'Pat',
lastName: 'Kake',
communicationPreference: {email: true, sms: true},
contactnumber: '+923333709568',
middleName: 'E',
segment: ['employee'],
employeeId: '345'
})
};
fetch('https://prod01.copilot.fabric.inc/data-subscription/v1/customers', 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://prod01.copilot.fabric.inc/data-subscription/v1/customers",
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([
'customerReferenceId' => '12345',
'locale' => 'en_US',
'email' => 'customer@example.com',
'firstName' => 'Pat',
'lastName' => 'Kake',
'communicationPreference' => [
'email' => true,
'sms' => true
],
'contactnumber' => '+923333709568',
'middleName' => 'E',
'segment' => [
'employee'
],
'employeeId' => '345'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://prod01.copilot.fabric.inc/data-subscription/v1/customers"
payload := strings.NewReader("{\n \"customerReferenceId\": \"12345\",\n \"locale\": \"en_US\",\n \"email\": \"customer@example.com\",\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"communicationPreference\": {\n \"email\": true,\n \"sms\": true\n },\n \"contactnumber\": \"+923333709568\",\n \"middleName\": \"E\",\n \"segment\": [\n \"employee\"\n ],\n \"employeeId\": \"345\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://prod01.copilot.fabric.inc/data-subscription/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customerReferenceId\": \"12345\",\n \"locale\": \"en_US\",\n \"email\": \"customer@example.com\",\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"communicationPreference\": {\n \"email\": true,\n \"sms\": true\n },\n \"contactnumber\": \"+923333709568\",\n \"middleName\": \"E\",\n \"segment\": [\n \"employee\"\n ],\n \"employeeId\": \"345\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod01.copilot.fabric.inc/data-subscription/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerReferenceId\": \"12345\",\n \"locale\": \"en_US\",\n \"email\": \"customer@example.com\",\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"communicationPreference\": {\n \"email\": true,\n \"sms\": true\n },\n \"contactnumber\": \"+923333709568\",\n \"middleName\": \"E\",\n \"segment\": [\n \"employee\"\n ],\n \"employeeId\": \"345\"\n}"
response = http.request(request)
puts response.read_body{
"id": "62cffd65e8d7eb868c6a29d6",
"customerReferenceId": "12345",
"locale": "en_US",
"email": "customer@example.com",
"contactNumber": "+923333709568",
"firstName": "Pat",
"middleName": "E",
"lastName": "Kake",
"segment": [
"employee"
],
"employeeId": "345",
"communicationPreference": {
"email": true,
"sms": true
},
"status": "ACTIVE",
"createdAt": "2021-10-12T21:35:05.756Z",
"updatedAt": "2021-10-14T05:40:55.997Z"
}{
"responseStatus": "BAD_REQUEST",
"message": "Bad request"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Details of customer being created
Customer details
Unique customer reference ID
"12345"
Customer locale (language_country)
"en_US"
Customer's email address
"customer@example.com"
Customer's first name
"Pat"
Customer's last name
"Kake"
Customer's communications preferences
Show child attributes
Show child attributes
Customer's contact number
"+923333709568"
Customer's middle name or initial
"E"
Customer's segments
Customer's segment (employee, management, pro user, etc.)
Customer employee ID
"345"
Response
Request processed successfully
Customer details after creation
Customer ID
"62cffd65e8d7eb868c6a29d6"
Customer reference ID
"12345"
Customer locale (language_country)
"en_US"
Customer's email address
"customer@example.com"
Customer's contact number
"+923333709568"
Customer's first name
"Pat"
Customer's middle name or initial
"E"
Customer's last name
"Kake"
Customer's segments
Customer's segment (employee, management, pro user, etc.)
Customer employee ID
"345"
Customer's communications preferences
Show child attributes
Show child attributes
Customer status
ACTIVE, INACTIVE "ACTIVE"
Time customer was created
"2021-10-12T21:35:05.756Z"
Most recent time customer was updated
"2021-10-14T05:40:55.997Z"
Was this page helpful?
