Create bulk subscriptions
curl --request POST \
--url https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel": "WEBSITE",
"shipTo": {
"name": {
"firstName": "Pat",
"lastName": "Kake",
"middleName": "E"
},
"streetAddress": {
"street1": "123 Main St",
"street2": "Suite 100"
},
"city": "Boston",
"state": "MA",
"postalCode": "02127",
"country": "US",
"phone": {
"number": "5555551234",
"kind": "home"
}
},
"billTo": {
"name": {
"firstName": "Pat",
"lastName": "Kake",
"middleName": "E"
},
"streetAddress": {
"street1": "123 Main St",
"street2": "Suite 100"
},
"city": "Boston",
"state": "MA",
"postalCode": "02127",
"country": "US",
"phone": {
"number": "5555551234",
"kind": "home"
}
},
"paymentDetails": {
"paymentIdentifier": {
"cardIdentifier": "1234",
"expiryDate": "12/20"
},
"paymentMethod": "credit_card",
"paymentKind": "Visa"
},
"originOrderId": "22-4498-4800",
"customAttributes": {
"storeId": "60cb07fc20387b000821c5c3",
"associateId": 1,
"trackingUrl": "609436d21baded0008945b05"
},
"item": [
{
"id": 1000000006,
"sku": "MOBO-X570",
"quantity": 1,
"weight": 10,
"weightUnit": "lb",
"offsetDays": 2,
"expiry": {
"expiryDate": "2022-07-18T09:16:11.437Z",
"billingCycles": 2
}
}
]
}
'import requests
url = "https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/bulk"
payload = {
"channel": "WEBSITE",
"shipTo": {
"name": {
"firstName": "Pat",
"lastName": "Kake",
"middleName": "E"
},
"streetAddress": {
"street1": "123 Main St",
"street2": "Suite 100"
},
"city": "Boston",
"state": "MA",
"postalCode": "02127",
"country": "US",
"phone": {
"number": "5555551234",
"kind": "home"
}
},
"billTo": {
"name": {
"firstName": "Pat",
"lastName": "Kake",
"middleName": "E"
},
"streetAddress": {
"street1": "123 Main St",
"street2": "Suite 100"
},
"city": "Boston",
"state": "MA",
"postalCode": "02127",
"country": "US",
"phone": {
"number": "5555551234",
"kind": "home"
}
},
"paymentDetails": {
"paymentIdentifier": {
"cardIdentifier": "1234",
"expiryDate": "12/20"
},
"paymentMethod": "credit_card",
"paymentKind": "Visa"
},
"originOrderId": "22-4498-4800",
"customAttributes": {
"storeId": "60cb07fc20387b000821c5c3",
"associateId": 1,
"trackingUrl": "609436d21baded0008945b05"
},
"item": [
{
"id": 1000000006,
"sku": "MOBO-X570",
"quantity": 1,
"weight": 10,
"weightUnit": "lb",
"offsetDays": 2,
"expiry": {
"expiryDate": "2022-07-18T09:16:11.437Z",
"billingCycles": 2
}
}
]
}
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({
channel: 'WEBSITE',
shipTo: {
name: {firstName: 'Pat', lastName: 'Kake', middleName: 'E'},
streetAddress: {street1: '123 Main St', street2: 'Suite 100'},
city: 'Boston',
state: 'MA',
postalCode: '02127',
country: 'US',
phone: {number: '5555551234', kind: 'home'}
},
billTo: {
name: {firstName: 'Pat', lastName: 'Kake', middleName: 'E'},
streetAddress: {street1: '123 Main St', street2: 'Suite 100'},
city: 'Boston',
state: 'MA',
postalCode: '02127',
country: 'US',
phone: {number: '5555551234', kind: 'home'}
},
paymentDetails: {
paymentIdentifier: {cardIdentifier: '1234', expiryDate: '12/20'},
paymentMethod: 'credit_card',
paymentKind: 'Visa'
},
originOrderId: '22-4498-4800',
customAttributes: {
storeId: '60cb07fc20387b000821c5c3',
associateId: 1,
trackingUrl: '609436d21baded0008945b05'
},
item: [
{
id: 1000000006,
sku: 'MOBO-X570',
quantity: 1,
weight: 10,
weightUnit: 'lb',
offsetDays: 2,
expiry: {expiryDate: '2022-07-18T09:16:11.437Z', billingCycles: 2}
}
]
})
};
fetch('https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/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://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/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([
'channel' => 'WEBSITE',
'shipTo' => [
'name' => [
'firstName' => 'Pat',
'lastName' => 'Kake',
'middleName' => 'E'
],
'streetAddress' => [
'street1' => '123 Main St',
'street2' => 'Suite 100'
],
'city' => 'Boston',
'state' => 'MA',
'postalCode' => '02127',
'country' => 'US',
'phone' => [
'number' => '5555551234',
'kind' => 'home'
]
],
'billTo' => [
'name' => [
'firstName' => 'Pat',
'lastName' => 'Kake',
'middleName' => 'E'
],
'streetAddress' => [
'street1' => '123 Main St',
'street2' => 'Suite 100'
],
'city' => 'Boston',
'state' => 'MA',
'postalCode' => '02127',
'country' => 'US',
'phone' => [
'number' => '5555551234',
'kind' => 'home'
]
],
'paymentDetails' => [
'paymentIdentifier' => [
'cardIdentifier' => '1234',
'expiryDate' => '12/20'
],
'paymentMethod' => 'credit_card',
'paymentKind' => 'Visa'
],
'originOrderId' => '22-4498-4800',
'customAttributes' => [
'storeId' => '60cb07fc20387b000821c5c3',
'associateId' => 1,
'trackingUrl' => '609436d21baded0008945b05'
],
'item' => [
[
'id' => 1000000006,
'sku' => 'MOBO-X570',
'quantity' => 1,
'weight' => 10,
'weightUnit' => 'lb',
'offsetDays' => 2,
'expiry' => [
'expiryDate' => '2022-07-18T09:16:11.437Z',
'billingCycles' => 2
]
]
]
]),
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/subscriptions/bulk"
payload := strings.NewReader("{\n \"channel\": \"WEBSITE\",\n \"shipTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"billTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"paymentDetails\": {\n \"paymentIdentifier\": {\n \"cardIdentifier\": \"1234\",\n \"expiryDate\": \"12/20\"\n },\n \"paymentMethod\": \"credit_card\",\n \"paymentKind\": \"Visa\"\n },\n \"originOrderId\": \"22-4498-4800\",\n \"customAttributes\": {\n \"storeId\": \"60cb07fc20387b000821c5c3\",\n \"associateId\": 1,\n \"trackingUrl\": \"609436d21baded0008945b05\"\n },\n \"item\": [\n {\n \"id\": 1000000006,\n \"sku\": \"MOBO-X570\",\n \"quantity\": 1,\n \"weight\": 10,\n \"weightUnit\": \"lb\",\n \"offsetDays\": 2,\n \"expiry\": {\n \"expiryDate\": \"2022-07-18T09:16:11.437Z\",\n \"billingCycles\": 2\n }\n }\n ]\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/subscriptions/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channel\": \"WEBSITE\",\n \"shipTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"billTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"paymentDetails\": {\n \"paymentIdentifier\": {\n \"cardIdentifier\": \"1234\",\n \"expiryDate\": \"12/20\"\n },\n \"paymentMethod\": \"credit_card\",\n \"paymentKind\": \"Visa\"\n },\n \"originOrderId\": \"22-4498-4800\",\n \"customAttributes\": {\n \"storeId\": \"60cb07fc20387b000821c5c3\",\n \"associateId\": 1,\n \"trackingUrl\": \"609436d21baded0008945b05\"\n },\n \"item\": [\n {\n \"id\": 1000000006,\n \"sku\": \"MOBO-X570\",\n \"quantity\": 1,\n \"weight\": 10,\n \"weightUnit\": \"lb\",\n \"offsetDays\": 2,\n \"expiry\": {\n \"expiryDate\": \"2022-07-18T09:16:11.437Z\",\n \"billingCycles\": 2\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/bulk")
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 \"channel\": \"WEBSITE\",\n \"shipTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"billTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"paymentDetails\": {\n \"paymentIdentifier\": {\n \"cardIdentifier\": \"1234\",\n \"expiryDate\": \"12/20\"\n },\n \"paymentMethod\": \"credit_card\",\n \"paymentKind\": \"Visa\"\n },\n \"originOrderId\": \"22-4498-4800\",\n \"customAttributes\": {\n \"storeId\": \"60cb07fc20387b000821c5c3\",\n \"associateId\": 1,\n \"trackingUrl\": \"609436d21baded0008945b05\"\n },\n \"item\": [\n {\n \"id\": 1000000006,\n \"sku\": \"MOBO-X570\",\n \"quantity\": 1,\n \"weight\": 10,\n \"weightUnit\": \"lb\",\n \"offsetDays\": 2,\n \"expiry\": {\n \"expiryDate\": \"2022-07-18T09:16:11.437Z\",\n \"billingCycles\": 2\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"responseStatus": "OK",
"message": "Request processed successfully",
"data": {
"subscriptions": [
{
"id": "6256610bc312410009b7390b",
"item": {
"sku": "MOBO-X570"
},
"customer": {
"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"
}
}
],
"errors": [
{
"lineItemId": 1,
"code": "SUBSCRIPTION_NOT_FOUND"
}
]
}
}{
"responseStatus": "BAD_REQUEST",
"message": "Bad request",
"data": {
"errors": [
{
"errorCode": "PRODUCT_DOES_NOT_EXIST",
"errorMessage": "Product with the specified SKU or Item ID does not exist",
"item": {
"sku": "MOBO-X570"
}
}
]
}
}Subscriptions
Create bulk subscriptions
Create bulk subscriptions
POST
/
v1
/
subscriptions
/
bulk
Create bulk subscriptions
curl --request POST \
--url https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel": "WEBSITE",
"shipTo": {
"name": {
"firstName": "Pat",
"lastName": "Kake",
"middleName": "E"
},
"streetAddress": {
"street1": "123 Main St",
"street2": "Suite 100"
},
"city": "Boston",
"state": "MA",
"postalCode": "02127",
"country": "US",
"phone": {
"number": "5555551234",
"kind": "home"
}
},
"billTo": {
"name": {
"firstName": "Pat",
"lastName": "Kake",
"middleName": "E"
},
"streetAddress": {
"street1": "123 Main St",
"street2": "Suite 100"
},
"city": "Boston",
"state": "MA",
"postalCode": "02127",
"country": "US",
"phone": {
"number": "5555551234",
"kind": "home"
}
},
"paymentDetails": {
"paymentIdentifier": {
"cardIdentifier": "1234",
"expiryDate": "12/20"
},
"paymentMethod": "credit_card",
"paymentKind": "Visa"
},
"originOrderId": "22-4498-4800",
"customAttributes": {
"storeId": "60cb07fc20387b000821c5c3",
"associateId": 1,
"trackingUrl": "609436d21baded0008945b05"
},
"item": [
{
"id": 1000000006,
"sku": "MOBO-X570",
"quantity": 1,
"weight": 10,
"weightUnit": "lb",
"offsetDays": 2,
"expiry": {
"expiryDate": "2022-07-18T09:16:11.437Z",
"billingCycles": 2
}
}
]
}
'import requests
url = "https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/bulk"
payload = {
"channel": "WEBSITE",
"shipTo": {
"name": {
"firstName": "Pat",
"lastName": "Kake",
"middleName": "E"
},
"streetAddress": {
"street1": "123 Main St",
"street2": "Suite 100"
},
"city": "Boston",
"state": "MA",
"postalCode": "02127",
"country": "US",
"phone": {
"number": "5555551234",
"kind": "home"
}
},
"billTo": {
"name": {
"firstName": "Pat",
"lastName": "Kake",
"middleName": "E"
},
"streetAddress": {
"street1": "123 Main St",
"street2": "Suite 100"
},
"city": "Boston",
"state": "MA",
"postalCode": "02127",
"country": "US",
"phone": {
"number": "5555551234",
"kind": "home"
}
},
"paymentDetails": {
"paymentIdentifier": {
"cardIdentifier": "1234",
"expiryDate": "12/20"
},
"paymentMethod": "credit_card",
"paymentKind": "Visa"
},
"originOrderId": "22-4498-4800",
"customAttributes": {
"storeId": "60cb07fc20387b000821c5c3",
"associateId": 1,
"trackingUrl": "609436d21baded0008945b05"
},
"item": [
{
"id": 1000000006,
"sku": "MOBO-X570",
"quantity": 1,
"weight": 10,
"weightUnit": "lb",
"offsetDays": 2,
"expiry": {
"expiryDate": "2022-07-18T09:16:11.437Z",
"billingCycles": 2
}
}
]
}
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({
channel: 'WEBSITE',
shipTo: {
name: {firstName: 'Pat', lastName: 'Kake', middleName: 'E'},
streetAddress: {street1: '123 Main St', street2: 'Suite 100'},
city: 'Boston',
state: 'MA',
postalCode: '02127',
country: 'US',
phone: {number: '5555551234', kind: 'home'}
},
billTo: {
name: {firstName: 'Pat', lastName: 'Kake', middleName: 'E'},
streetAddress: {street1: '123 Main St', street2: 'Suite 100'},
city: 'Boston',
state: 'MA',
postalCode: '02127',
country: 'US',
phone: {number: '5555551234', kind: 'home'}
},
paymentDetails: {
paymentIdentifier: {cardIdentifier: '1234', expiryDate: '12/20'},
paymentMethod: 'credit_card',
paymentKind: 'Visa'
},
originOrderId: '22-4498-4800',
customAttributes: {
storeId: '60cb07fc20387b000821c5c3',
associateId: 1,
trackingUrl: '609436d21baded0008945b05'
},
item: [
{
id: 1000000006,
sku: 'MOBO-X570',
quantity: 1,
weight: 10,
weightUnit: 'lb',
offsetDays: 2,
expiry: {expiryDate: '2022-07-18T09:16:11.437Z', billingCycles: 2}
}
]
})
};
fetch('https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/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://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/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([
'channel' => 'WEBSITE',
'shipTo' => [
'name' => [
'firstName' => 'Pat',
'lastName' => 'Kake',
'middleName' => 'E'
],
'streetAddress' => [
'street1' => '123 Main St',
'street2' => 'Suite 100'
],
'city' => 'Boston',
'state' => 'MA',
'postalCode' => '02127',
'country' => 'US',
'phone' => [
'number' => '5555551234',
'kind' => 'home'
]
],
'billTo' => [
'name' => [
'firstName' => 'Pat',
'lastName' => 'Kake',
'middleName' => 'E'
],
'streetAddress' => [
'street1' => '123 Main St',
'street2' => 'Suite 100'
],
'city' => 'Boston',
'state' => 'MA',
'postalCode' => '02127',
'country' => 'US',
'phone' => [
'number' => '5555551234',
'kind' => 'home'
]
],
'paymentDetails' => [
'paymentIdentifier' => [
'cardIdentifier' => '1234',
'expiryDate' => '12/20'
],
'paymentMethod' => 'credit_card',
'paymentKind' => 'Visa'
],
'originOrderId' => '22-4498-4800',
'customAttributes' => [
'storeId' => '60cb07fc20387b000821c5c3',
'associateId' => 1,
'trackingUrl' => '609436d21baded0008945b05'
],
'item' => [
[
'id' => 1000000006,
'sku' => 'MOBO-X570',
'quantity' => 1,
'weight' => 10,
'weightUnit' => 'lb',
'offsetDays' => 2,
'expiry' => [
'expiryDate' => '2022-07-18T09:16:11.437Z',
'billingCycles' => 2
]
]
]
]),
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/subscriptions/bulk"
payload := strings.NewReader("{\n \"channel\": \"WEBSITE\",\n \"shipTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"billTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"paymentDetails\": {\n \"paymentIdentifier\": {\n \"cardIdentifier\": \"1234\",\n \"expiryDate\": \"12/20\"\n },\n \"paymentMethod\": \"credit_card\",\n \"paymentKind\": \"Visa\"\n },\n \"originOrderId\": \"22-4498-4800\",\n \"customAttributes\": {\n \"storeId\": \"60cb07fc20387b000821c5c3\",\n \"associateId\": 1,\n \"trackingUrl\": \"609436d21baded0008945b05\"\n },\n \"item\": [\n {\n \"id\": 1000000006,\n \"sku\": \"MOBO-X570\",\n \"quantity\": 1,\n \"weight\": 10,\n \"weightUnit\": \"lb\",\n \"offsetDays\": 2,\n \"expiry\": {\n \"expiryDate\": \"2022-07-18T09:16:11.437Z\",\n \"billingCycles\": 2\n }\n }\n ]\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/subscriptions/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channel\": \"WEBSITE\",\n \"shipTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"billTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"paymentDetails\": {\n \"paymentIdentifier\": {\n \"cardIdentifier\": \"1234\",\n \"expiryDate\": \"12/20\"\n },\n \"paymentMethod\": \"credit_card\",\n \"paymentKind\": \"Visa\"\n },\n \"originOrderId\": \"22-4498-4800\",\n \"customAttributes\": {\n \"storeId\": \"60cb07fc20387b000821c5c3\",\n \"associateId\": 1,\n \"trackingUrl\": \"609436d21baded0008945b05\"\n },\n \"item\": [\n {\n \"id\": 1000000006,\n \"sku\": \"MOBO-X570\",\n \"quantity\": 1,\n \"weight\": 10,\n \"weightUnit\": \"lb\",\n \"offsetDays\": 2,\n \"expiry\": {\n \"expiryDate\": \"2022-07-18T09:16:11.437Z\",\n \"billingCycles\": 2\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptions/bulk")
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 \"channel\": \"WEBSITE\",\n \"shipTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"billTo\": {\n \"name\": {\n \"firstName\": \"Pat\",\n \"lastName\": \"Kake\",\n \"middleName\": \"E\"\n },\n \"streetAddress\": {\n \"street1\": \"123 Main St\",\n \"street2\": \"Suite 100\"\n },\n \"city\": \"Boston\",\n \"state\": \"MA\",\n \"postalCode\": \"02127\",\n \"country\": \"US\",\n \"phone\": {\n \"number\": \"5555551234\",\n \"kind\": \"home\"\n }\n },\n \"paymentDetails\": {\n \"paymentIdentifier\": {\n \"cardIdentifier\": \"1234\",\n \"expiryDate\": \"12/20\"\n },\n \"paymentMethod\": \"credit_card\",\n \"paymentKind\": \"Visa\"\n },\n \"originOrderId\": \"22-4498-4800\",\n \"customAttributes\": {\n \"storeId\": \"60cb07fc20387b000821c5c3\",\n \"associateId\": 1,\n \"trackingUrl\": \"609436d21baded0008945b05\"\n },\n \"item\": [\n {\n \"id\": 1000000006,\n \"sku\": \"MOBO-X570\",\n \"quantity\": 1,\n \"weight\": 10,\n \"weightUnit\": \"lb\",\n \"offsetDays\": 2,\n \"expiry\": {\n \"expiryDate\": \"2022-07-18T09:16:11.437Z\",\n \"billingCycles\": 2\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"responseStatus": "OK",
"message": "Request processed successfully",
"data": {
"subscriptions": [
{
"id": "6256610bc312410009b7390b",
"item": {
"sku": "MOBO-X570"
},
"customer": {
"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"
}
}
],
"errors": [
{
"lineItemId": 1,
"code": "SUBSCRIPTION_NOT_FOUND"
}
]
}
}{
"responseStatus": "BAD_REQUEST",
"message": "Bad request",
"data": {
"errors": [
{
"errorCode": "PRODUCT_DOES_NOT_EXIST",
"errorMessage": "Product with the specified SKU or Item ID does not exist",
"item": {
"sku": "MOBO-X570"
}
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Details used to create bulk subscription
Channel
Available options:
WEBSITE, POS Example:
"WEBSITE"
Ship-to address and phone details
Show child attributes
Show child attributes
Bill-to address and phone details
Show child attributes
Show child attributes
Payment details
Show child attributes
Show child attributes
Client's origin order ID
Example:
"22-4498-4800"
Customer details
Show child attributes
Show child attributes
Custom attributes
Show child attributes
Show child attributes
Subscription items
Show child attributes
Show child attributes
Response
Request processed successfully
Was this page helpful?
⌘I
