Create subscription discounts
curl --request POST \
--url https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"validity": {
"startDate": "2022-07-21T13:14:51.474Z",
"endDate": "2022-07-21T13:14:51.474Z",
"applyOnOrders": [
2,
3
]
},
"message": "Offer terms and conditions",
"discount": {
"amount": 10
},
"skus": [
"MOBO-X570"
],
"categories": [
"holiday-best-sellers"
],
"frequency": {
"shippingFrequency": 1,
"shippingFrequencyType": "daily",
"billingFrequency": 1,
"billingFrequencyType": "daily"
},
"itemQuantity": 1,
"channel": "WEBSITE",
"target": "PDP",
"customerSegment": [
"employee"
]
}
'import requests
url = "https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount"
payload = {
"validity": {
"startDate": "2022-07-21T13:14:51.474Z",
"endDate": "2022-07-21T13:14:51.474Z",
"applyOnOrders": [2, 3]
},
"message": "Offer terms and conditions",
"discount": { "amount": 10 },
"skus": ["MOBO-X570"],
"categories": ["holiday-best-sellers"],
"frequency": {
"shippingFrequency": 1,
"shippingFrequencyType": "daily",
"billingFrequency": 1,
"billingFrequencyType": "daily"
},
"itemQuantity": 1,
"channel": "WEBSITE",
"target": "PDP",
"customerSegment": ["employee"]
}
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({
validity: {
startDate: '2022-07-21T13:14:51.474Z',
endDate: '2022-07-21T13:14:51.474Z',
applyOnOrders: [2, 3]
},
message: 'Offer terms and conditions',
discount: {amount: 10},
skus: ['MOBO-X570'],
categories: ['holiday-best-sellers'],
frequency: {
shippingFrequency: 1,
shippingFrequencyType: 'daily',
billingFrequency: 1,
billingFrequencyType: 'daily'
},
itemQuantity: 1,
channel: 'WEBSITE',
target: 'PDP',
customerSegment: ['employee']
})
};
fetch('https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount', 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/subscriptionDiscount",
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([
'validity' => [
'startDate' => '2022-07-21T13:14:51.474Z',
'endDate' => '2022-07-21T13:14:51.474Z',
'applyOnOrders' => [
2,
3
]
],
'message' => 'Offer terms and conditions',
'discount' => [
'amount' => 10
],
'skus' => [
'MOBO-X570'
],
'categories' => [
'holiday-best-sellers'
],
'frequency' => [
'shippingFrequency' => 1,
'shippingFrequencyType' => 'daily',
'billingFrequency' => 1,
'billingFrequencyType' => 'daily'
],
'itemQuantity' => 1,
'channel' => 'WEBSITE',
'target' => 'PDP',
'customerSegment' => [
'employee'
]
]),
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/subscriptionDiscount"
payload := strings.NewReader("{\n \"validity\": {\n \"startDate\": \"2022-07-21T13:14:51.474Z\",\n \"endDate\": \"2022-07-21T13:14:51.474Z\",\n \"applyOnOrders\": [\n 2,\n 3\n ]\n },\n \"message\": \"Offer terms and conditions\",\n \"discount\": {\n \"amount\": 10\n },\n \"skus\": [\n \"MOBO-X570\"\n ],\n \"categories\": [\n \"holiday-best-sellers\"\n ],\n \"frequency\": {\n \"shippingFrequency\": 1,\n \"shippingFrequencyType\": \"daily\",\n \"billingFrequency\": 1,\n \"billingFrequencyType\": \"daily\"\n },\n \"itemQuantity\": 1,\n \"channel\": \"WEBSITE\",\n \"target\": \"PDP\",\n \"customerSegment\": [\n \"employee\"\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/subscriptionDiscount")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"validity\": {\n \"startDate\": \"2022-07-21T13:14:51.474Z\",\n \"endDate\": \"2022-07-21T13:14:51.474Z\",\n \"applyOnOrders\": [\n 2,\n 3\n ]\n },\n \"message\": \"Offer terms and conditions\",\n \"discount\": {\n \"amount\": 10\n },\n \"skus\": [\n \"MOBO-X570\"\n ],\n \"categories\": [\n \"holiday-best-sellers\"\n ],\n \"frequency\": {\n \"shippingFrequency\": 1,\n \"shippingFrequencyType\": \"daily\",\n \"billingFrequency\": 1,\n \"billingFrequencyType\": \"daily\"\n },\n \"itemQuantity\": 1,\n \"channel\": \"WEBSITE\",\n \"target\": \"PDP\",\n \"customerSegment\": [\n \"employee\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount")
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 \"validity\": {\n \"startDate\": \"2022-07-21T13:14:51.474Z\",\n \"endDate\": \"2022-07-21T13:14:51.474Z\",\n \"applyOnOrders\": [\n 2,\n 3\n ]\n },\n \"message\": \"Offer terms and conditions\",\n \"discount\": {\n \"amount\": 10\n },\n \"skus\": [\n \"MOBO-X570\"\n ],\n \"categories\": [\n \"holiday-best-sellers\"\n ],\n \"frequency\": {\n \"shippingFrequency\": 1,\n \"shippingFrequencyType\": \"daily\",\n \"billingFrequency\": 1,\n \"billingFrequencyType\": \"daily\"\n },\n \"itemQuantity\": 1,\n \"channel\": \"WEBSITE\",\n \"target\": \"PDP\",\n \"customerSegment\": [\n \"employee\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"responseStatus": "OK",
"message": "Request processed successfully",
"data": {
"id": "62d9196aeec12800095633f2",
"status": "ACTIVE",
"offerCode": "SUB-D45DD7",
"validity": {
"startDate": "2022-07-21T13:14:51.474Z",
"endDate": "2022-07-21T13:14:51.474Z",
"applyOnOrders": [
2,
3
]
},
"message": "Offer terms and conditions",
"discount": {
"amount": 10
},
"skus": [
"MOBO-X570"
],
"categories": [
"holiday-best-sellers"
],
"frequency": {
"shippingFrequency": 1,
"shippingFrequencyType": "daily",
"billingFrequency": 1,
"billingFrequencyType": "daily"
},
"itemQuantity": 1,
"channel": "WEBSITE",
"target": "PDP",
"customerSegment": [
"employee"
],
"isDeleted": false,
"DeletedAt": "2019-01-01T00:00:00.000Z",
"createdAt": "2021-10-12T21:35:05.756Z",
"updatedAt": "2021-10-14T05:40:55.997Z"
}
}{
"responseStatus": "BAD_REQUEST",
"message": "Bad request"
}{
"Message": "User is not authorized to access this resource with an explicit deny"
}Subscription Discounts
Create subscription discounts
Create subscription discounts
POST
/
v1
/
subscriptionDiscount
Create subscription discounts
curl --request POST \
--url https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"validity": {
"startDate": "2022-07-21T13:14:51.474Z",
"endDate": "2022-07-21T13:14:51.474Z",
"applyOnOrders": [
2,
3
]
},
"message": "Offer terms and conditions",
"discount": {
"amount": 10
},
"skus": [
"MOBO-X570"
],
"categories": [
"holiday-best-sellers"
],
"frequency": {
"shippingFrequency": 1,
"shippingFrequencyType": "daily",
"billingFrequency": 1,
"billingFrequencyType": "daily"
},
"itemQuantity": 1,
"channel": "WEBSITE",
"target": "PDP",
"customerSegment": [
"employee"
]
}
'import requests
url = "https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount"
payload = {
"validity": {
"startDate": "2022-07-21T13:14:51.474Z",
"endDate": "2022-07-21T13:14:51.474Z",
"applyOnOrders": [2, 3]
},
"message": "Offer terms and conditions",
"discount": { "amount": 10 },
"skus": ["MOBO-X570"],
"categories": ["holiday-best-sellers"],
"frequency": {
"shippingFrequency": 1,
"shippingFrequencyType": "daily",
"billingFrequency": 1,
"billingFrequencyType": "daily"
},
"itemQuantity": 1,
"channel": "WEBSITE",
"target": "PDP",
"customerSegment": ["employee"]
}
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({
validity: {
startDate: '2022-07-21T13:14:51.474Z',
endDate: '2022-07-21T13:14:51.474Z',
applyOnOrders: [2, 3]
},
message: 'Offer terms and conditions',
discount: {amount: 10},
skus: ['MOBO-X570'],
categories: ['holiday-best-sellers'],
frequency: {
shippingFrequency: 1,
shippingFrequencyType: 'daily',
billingFrequency: 1,
billingFrequencyType: 'daily'
},
itemQuantity: 1,
channel: 'WEBSITE',
target: 'PDP',
customerSegment: ['employee']
})
};
fetch('https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount', 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/subscriptionDiscount",
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([
'validity' => [
'startDate' => '2022-07-21T13:14:51.474Z',
'endDate' => '2022-07-21T13:14:51.474Z',
'applyOnOrders' => [
2,
3
]
],
'message' => 'Offer terms and conditions',
'discount' => [
'amount' => 10
],
'skus' => [
'MOBO-X570'
],
'categories' => [
'holiday-best-sellers'
],
'frequency' => [
'shippingFrequency' => 1,
'shippingFrequencyType' => 'daily',
'billingFrequency' => 1,
'billingFrequencyType' => 'daily'
],
'itemQuantity' => 1,
'channel' => 'WEBSITE',
'target' => 'PDP',
'customerSegment' => [
'employee'
]
]),
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/subscriptionDiscount"
payload := strings.NewReader("{\n \"validity\": {\n \"startDate\": \"2022-07-21T13:14:51.474Z\",\n \"endDate\": \"2022-07-21T13:14:51.474Z\",\n \"applyOnOrders\": [\n 2,\n 3\n ]\n },\n \"message\": \"Offer terms and conditions\",\n \"discount\": {\n \"amount\": 10\n },\n \"skus\": [\n \"MOBO-X570\"\n ],\n \"categories\": [\n \"holiday-best-sellers\"\n ],\n \"frequency\": {\n \"shippingFrequency\": 1,\n \"shippingFrequencyType\": \"daily\",\n \"billingFrequency\": 1,\n \"billingFrequencyType\": \"daily\"\n },\n \"itemQuantity\": 1,\n \"channel\": \"WEBSITE\",\n \"target\": \"PDP\",\n \"customerSegment\": [\n \"employee\"\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/subscriptionDiscount")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"validity\": {\n \"startDate\": \"2022-07-21T13:14:51.474Z\",\n \"endDate\": \"2022-07-21T13:14:51.474Z\",\n \"applyOnOrders\": [\n 2,\n 3\n ]\n },\n \"message\": \"Offer terms and conditions\",\n \"discount\": {\n \"amount\": 10\n },\n \"skus\": [\n \"MOBO-X570\"\n ],\n \"categories\": [\n \"holiday-best-sellers\"\n ],\n \"frequency\": {\n \"shippingFrequency\": 1,\n \"shippingFrequencyType\": \"daily\",\n \"billingFrequency\": 1,\n \"billingFrequencyType\": \"daily\"\n },\n \"itemQuantity\": 1,\n \"channel\": \"WEBSITE\",\n \"target\": \"PDP\",\n \"customerSegment\": [\n \"employee\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount")
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 \"validity\": {\n \"startDate\": \"2022-07-21T13:14:51.474Z\",\n \"endDate\": \"2022-07-21T13:14:51.474Z\",\n \"applyOnOrders\": [\n 2,\n 3\n ]\n },\n \"message\": \"Offer terms and conditions\",\n \"discount\": {\n \"amount\": 10\n },\n \"skus\": [\n \"MOBO-X570\"\n ],\n \"categories\": [\n \"holiday-best-sellers\"\n ],\n \"frequency\": {\n \"shippingFrequency\": 1,\n \"shippingFrequencyType\": \"daily\",\n \"billingFrequency\": 1,\n \"billingFrequencyType\": \"daily\"\n },\n \"itemQuantity\": 1,\n \"channel\": \"WEBSITE\",\n \"target\": \"PDP\",\n \"customerSegment\": [\n \"employee\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"responseStatus": "OK",
"message": "Request processed successfully",
"data": {
"id": "62d9196aeec12800095633f2",
"status": "ACTIVE",
"offerCode": "SUB-D45DD7",
"validity": {
"startDate": "2022-07-21T13:14:51.474Z",
"endDate": "2022-07-21T13:14:51.474Z",
"applyOnOrders": [
2,
3
]
},
"message": "Offer terms and conditions",
"discount": {
"amount": 10
},
"skus": [
"MOBO-X570"
],
"categories": [
"holiday-best-sellers"
],
"frequency": {
"shippingFrequency": 1,
"shippingFrequencyType": "daily",
"billingFrequency": 1,
"billingFrequencyType": "daily"
},
"itemQuantity": 1,
"channel": "WEBSITE",
"target": "PDP",
"customerSegment": [
"employee"
],
"isDeleted": false,
"DeletedAt": "2019-01-01T00:00:00.000Z",
"createdAt": "2021-10-12T21:35:05.756Z",
"updatedAt": "2021-10-14T05:40:55.997Z"
}
}{
"responseStatus": "BAD_REQUEST",
"message": "Bad request"
}{
"Message": "User is not authorized to access this resource with an explicit deny"
}Authorizations
Body
application/json
Details of subscription discount to be created
Details of discount to be created
Was this page helpful?
