curl --request POST \
--url https://live.copilot.fabric.inc/v1/price/get-by-sku \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-site-context: <x-site-context>' \
--data '
{
"traceId": 394823457,
"priceList": [
100275,
100276
],
"sku": [
1000019501,
1000019502
],
"itemId": [
111111,
222222
],
"userId": "5e2cfb9b45570b000864c4b5",
"userProfile": {
"Customer Type": [
"Wholesale"
]
},
"isLoggedIn": true,
"channel": [
12,
15
],
"date": "2019-08-24T14:15:22Z",
"priceParams": [
{
"options": {
"length": "2",
"width": "15",
"blindMotor": true
},
"sku": "11111",
"quantity": 5,
"itemId": 12345
}
],
"audit": true
}
'import requests
url = "https://live.copilot.fabric.inc/v1/price/get-by-sku"
payload = {
"traceId": 394823457,
"priceList": [100275, 100276],
"sku": [1000019501, 1000019502],
"itemId": [111111, 222222],
"userId": "5e2cfb9b45570b000864c4b5",
"userProfile": { "Customer Type": ["Wholesale"] },
"isLoggedIn": True,
"channel": [12, 15],
"date": "2019-08-24T14:15:22Z",
"priceParams": [
{
"options": {
"length": "2",
"width": "15",
"blindMotor": True
},
"sku": "11111",
"quantity": 5,
"itemId": 12345
}
],
"audit": True
}
headers = {
"x-site-context": "<x-site-context>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-site-context': '<x-site-context>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
traceId: 394823457,
priceList: [100275, 100276],
sku: [1000019501, 1000019502],
itemId: [111111, 222222],
userId: '5e2cfb9b45570b000864c4b5',
userProfile: {'Customer Type': ['Wholesale']},
isLoggedIn: true,
channel: [12, 15],
date: '2019-08-24T14:15:22Z',
priceParams: [
{
options: {length: '2', width: '15', blindMotor: true},
sku: '11111',
quantity: 5,
itemId: 12345
}
],
audit: true
})
};
fetch('https://live.copilot.fabric.inc/v1/price/get-by-sku', 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://live.copilot.fabric.inc/v1/price/get-by-sku",
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([
'traceId' => 394823457,
'priceList' => [
100275,
100276
],
'sku' => [
1000019501,
1000019502
],
'itemId' => [
111111,
222222
],
'userId' => '5e2cfb9b45570b000864c4b5',
'userProfile' => [
'Customer Type' => [
'Wholesale'
]
],
'isLoggedIn' => true,
'channel' => [
12,
15
],
'date' => '2019-08-24T14:15:22Z',
'priceParams' => [
[
'options' => [
'length' => '2',
'width' => '15',
'blindMotor' => true
],
'sku' => '11111',
'quantity' => 5,
'itemId' => 12345
]
],
'audit' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-site-context: <x-site-context>"
],
]);
$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://live.copilot.fabric.inc/v1/price/get-by-sku"
payload := strings.NewReader("{\n \"traceId\": 394823457,\n \"priceList\": [\n 100275,\n 100276\n ],\n \"sku\": [\n 1000019501,\n 1000019502\n ],\n \"itemId\": [\n 111111,\n 222222\n ],\n \"userId\": \"5e2cfb9b45570b000864c4b5\",\n \"userProfile\": {\n \"Customer Type\": [\n \"Wholesale\"\n ]\n },\n \"isLoggedIn\": true,\n \"channel\": [\n 12,\n 15\n ],\n \"date\": \"2019-08-24T14:15:22Z\",\n \"priceParams\": [\n {\n \"options\": {\n \"length\": \"2\",\n \"width\": \"15\",\n \"blindMotor\": true\n },\n \"sku\": \"11111\",\n \"quantity\": 5,\n \"itemId\": 12345\n }\n ],\n \"audit\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-site-context", "<x-site-context>")
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://live.copilot.fabric.inc/v1/price/get-by-sku")
.header("x-site-context", "<x-site-context>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"traceId\": 394823457,\n \"priceList\": [\n 100275,\n 100276\n ],\n \"sku\": [\n 1000019501,\n 1000019502\n ],\n \"itemId\": [\n 111111,\n 222222\n ],\n \"userId\": \"5e2cfb9b45570b000864c4b5\",\n \"userProfile\": {\n \"Customer Type\": [\n \"Wholesale\"\n ]\n },\n \"isLoggedIn\": true,\n \"channel\": [\n 12,\n 15\n ],\n \"date\": \"2019-08-24T14:15:22Z\",\n \"priceParams\": [\n {\n \"options\": {\n \"length\": \"2\",\n \"width\": \"15\",\n \"blindMotor\": true\n },\n \"sku\": \"11111\",\n \"quantity\": 5,\n \"itemId\": 12345\n }\n ],\n \"audit\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://live.copilot.fabric.inc/v1/price/get-by-sku")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-site-context"] = '<x-site-context>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"traceId\": 394823457,\n \"priceList\": [\n 100275,\n 100276\n ],\n \"sku\": [\n 1000019501,\n 1000019502\n ],\n \"itemId\": [\n 111111,\n 222222\n ],\n \"userId\": \"5e2cfb9b45570b000864c4b5\",\n \"userProfile\": {\n \"Customer Type\": [\n \"Wholesale\"\n ]\n },\n \"isLoggedIn\": true,\n \"channel\": [\n 12,\n 15\n ],\n \"date\": \"2019-08-24T14:15:22Z\",\n \"priceParams\": [\n {\n \"options\": {\n \"length\": \"2\",\n \"width\": \"15\",\n \"blindMotor\": true\n },\n \"sku\": \"11111\",\n \"quantity\": 5,\n \"itemId\": 12345\n }\n ],\n \"audit\": true\n}"
response = http.request(request)
puts response.read_body[
{
"priceList": "100275",
"sku": "11111111",
"itemId": 11111111,
"offers": {
"price": {
"sale": 10,
"cost": 9,
"base": 10,
"finalPrice": 20,
"currency": "USD",
"totalPrice": 15
},
"kind": "BASE",
"channel": 12,
"discounts": [
{
"amount": 10,
"value": 20,
"groupId": "61a6354d0d70e30009415f16",
"promotionId": "6197ec46e836ff000952c668",
"priority": 1,
"stackable": true,
"title": "20% off",
"quantity": 5,
"promotionType": "COUPON",
"application": 1,
"isAlwaysApplied": false,
"level": 1,
"stackingType": "STACKABLE",
"proratedAmount": 10,
"proratedQuantity": 1,
"promotionMessages": [
{
"promoId": "61df12345678900009b7091c",
"title": "Buy 2 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP"
],
"locales": [
"en-CA"
],
"type": "DISCOUNT",
"threshold": 2
}
]
}
],
"additionalAttributes": [
{}
],
"promotionMessages": [
{
"promoId": "6197ec46e836ff000952c667",
"threshold": 3,
"message": "Add another pair of shoes to get free socks!",
"locales": [
"en-US",
"en-GB"
],
"type": "PROXIMITY"
},
{
"promoId": "6197ec46e836ff000952c668",
"title": "Get free socks!",
"message": "Buy two pairs of shoes and get a pair of socks for free!",
"locales": [
"en-US",
"en-GB"
],
"pages": [
"PDP",
"CART"
],
"type": "POTENTIAL_DISCOUNT"
}
]
},
"audit": {
"userId": "62f5e25ca090100009c6e0f0",
"priceMethodType": "SurfaceArea_Square_Increment",
"quantity": 5,
"options": {
"length": 12,
"width": 10
},
"appliedAddons": [
"blind-motor"
]
}
}
]{
"status": "NOT_FOUND",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Validation error",
"debugMessage": "Either item ID or SKU is mandatory.",
"subErrors": [
{
"object": "promotionsEvaluationRequest",
"field": "items[0].quantity",
"rejectedValue": -2,
"message": "Must be greater than 0"
}
]
}{
"status": "NOT_FOUND",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Validation error",
"debugMessage": "Either item ID or SKU is mandatory.",
"subErrors": [
{
"object": "promotionsEvaluationRequest",
"field": "items[0].quantity",
"rejectedValue": -2,
"message": "Must be greater than 0"
}
]
}{
"status": "NOT_FOUND",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Validation error",
"debugMessage": "Either item ID or SKU is mandatory.",
"subErrors": [
{
"object": "promotionsEvaluationRequest",
"field": "items[0].quantity",
"rejectedValue": -2,
"message": "Must be greater than 0"
}
]
}{
"status": "NOT_FOUND",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Validation error",
"debugMessage": "Either item ID or SKU is mandatory.",
"subErrors": [
{
"object": "promotionsEvaluationRequest",
"field": "items[0].quantity",
"rejectedValue": -2,
"message": "Must be greater than 0"
}
]
}Get calculated prices
Retrieves prices for items either by SKUs or by item IDs based on the customer specific configuration set in the backend.
curl --request POST \
--url https://live.copilot.fabric.inc/v1/price/get-by-sku \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-site-context: <x-site-context>' \
--data '
{
"traceId": 394823457,
"priceList": [
100275,
100276
],
"sku": [
1000019501,
1000019502
],
"itemId": [
111111,
222222
],
"userId": "5e2cfb9b45570b000864c4b5",
"userProfile": {
"Customer Type": [
"Wholesale"
]
},
"isLoggedIn": true,
"channel": [
12,
15
],
"date": "2019-08-24T14:15:22Z",
"priceParams": [
{
"options": {
"length": "2",
"width": "15",
"blindMotor": true
},
"sku": "11111",
"quantity": 5,
"itemId": 12345
}
],
"audit": true
}
'import requests
url = "https://live.copilot.fabric.inc/v1/price/get-by-sku"
payload = {
"traceId": 394823457,
"priceList": [100275, 100276],
"sku": [1000019501, 1000019502],
"itemId": [111111, 222222],
"userId": "5e2cfb9b45570b000864c4b5",
"userProfile": { "Customer Type": ["Wholesale"] },
"isLoggedIn": True,
"channel": [12, 15],
"date": "2019-08-24T14:15:22Z",
"priceParams": [
{
"options": {
"length": "2",
"width": "15",
"blindMotor": True
},
"sku": "11111",
"quantity": 5,
"itemId": 12345
}
],
"audit": True
}
headers = {
"x-site-context": "<x-site-context>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-site-context': '<x-site-context>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
traceId: 394823457,
priceList: [100275, 100276],
sku: [1000019501, 1000019502],
itemId: [111111, 222222],
userId: '5e2cfb9b45570b000864c4b5',
userProfile: {'Customer Type': ['Wholesale']},
isLoggedIn: true,
channel: [12, 15],
date: '2019-08-24T14:15:22Z',
priceParams: [
{
options: {length: '2', width: '15', blindMotor: true},
sku: '11111',
quantity: 5,
itemId: 12345
}
],
audit: true
})
};
fetch('https://live.copilot.fabric.inc/v1/price/get-by-sku', 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://live.copilot.fabric.inc/v1/price/get-by-sku",
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([
'traceId' => 394823457,
'priceList' => [
100275,
100276
],
'sku' => [
1000019501,
1000019502
],
'itemId' => [
111111,
222222
],
'userId' => '5e2cfb9b45570b000864c4b5',
'userProfile' => [
'Customer Type' => [
'Wholesale'
]
],
'isLoggedIn' => true,
'channel' => [
12,
15
],
'date' => '2019-08-24T14:15:22Z',
'priceParams' => [
[
'options' => [
'length' => '2',
'width' => '15',
'blindMotor' => true
],
'sku' => '11111',
'quantity' => 5,
'itemId' => 12345
]
],
'audit' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-site-context: <x-site-context>"
],
]);
$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://live.copilot.fabric.inc/v1/price/get-by-sku"
payload := strings.NewReader("{\n \"traceId\": 394823457,\n \"priceList\": [\n 100275,\n 100276\n ],\n \"sku\": [\n 1000019501,\n 1000019502\n ],\n \"itemId\": [\n 111111,\n 222222\n ],\n \"userId\": \"5e2cfb9b45570b000864c4b5\",\n \"userProfile\": {\n \"Customer Type\": [\n \"Wholesale\"\n ]\n },\n \"isLoggedIn\": true,\n \"channel\": [\n 12,\n 15\n ],\n \"date\": \"2019-08-24T14:15:22Z\",\n \"priceParams\": [\n {\n \"options\": {\n \"length\": \"2\",\n \"width\": \"15\",\n \"blindMotor\": true\n },\n \"sku\": \"11111\",\n \"quantity\": 5,\n \"itemId\": 12345\n }\n ],\n \"audit\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-site-context", "<x-site-context>")
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://live.copilot.fabric.inc/v1/price/get-by-sku")
.header("x-site-context", "<x-site-context>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"traceId\": 394823457,\n \"priceList\": [\n 100275,\n 100276\n ],\n \"sku\": [\n 1000019501,\n 1000019502\n ],\n \"itemId\": [\n 111111,\n 222222\n ],\n \"userId\": \"5e2cfb9b45570b000864c4b5\",\n \"userProfile\": {\n \"Customer Type\": [\n \"Wholesale\"\n ]\n },\n \"isLoggedIn\": true,\n \"channel\": [\n 12,\n 15\n ],\n \"date\": \"2019-08-24T14:15:22Z\",\n \"priceParams\": [\n {\n \"options\": {\n \"length\": \"2\",\n \"width\": \"15\",\n \"blindMotor\": true\n },\n \"sku\": \"11111\",\n \"quantity\": 5,\n \"itemId\": 12345\n }\n ],\n \"audit\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://live.copilot.fabric.inc/v1/price/get-by-sku")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-site-context"] = '<x-site-context>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"traceId\": 394823457,\n \"priceList\": [\n 100275,\n 100276\n ],\n \"sku\": [\n 1000019501,\n 1000019502\n ],\n \"itemId\": [\n 111111,\n 222222\n ],\n \"userId\": \"5e2cfb9b45570b000864c4b5\",\n \"userProfile\": {\n \"Customer Type\": [\n \"Wholesale\"\n ]\n },\n \"isLoggedIn\": true,\n \"channel\": [\n 12,\n 15\n ],\n \"date\": \"2019-08-24T14:15:22Z\",\n \"priceParams\": [\n {\n \"options\": {\n \"length\": \"2\",\n \"width\": \"15\",\n \"blindMotor\": true\n },\n \"sku\": \"11111\",\n \"quantity\": 5,\n \"itemId\": 12345\n }\n ],\n \"audit\": true\n}"
response = http.request(request)
puts response.read_body[
{
"priceList": "100275",
"sku": "11111111",
"itemId": 11111111,
"offers": {
"price": {
"sale": 10,
"cost": 9,
"base": 10,
"finalPrice": 20,
"currency": "USD",
"totalPrice": 15
},
"kind": "BASE",
"channel": 12,
"discounts": [
{
"amount": 10,
"value": 20,
"groupId": "61a6354d0d70e30009415f16",
"promotionId": "6197ec46e836ff000952c668",
"priority": 1,
"stackable": true,
"title": "20% off",
"quantity": 5,
"promotionType": "COUPON",
"application": 1,
"isAlwaysApplied": false,
"level": 1,
"stackingType": "STACKABLE",
"proratedAmount": 10,
"proratedQuantity": 1,
"promotionMessages": [
{
"promoId": "61df12345678900009b7091c",
"title": "Buy 2 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP"
],
"locales": [
"en-CA"
],
"type": "DISCOUNT",
"threshold": 2
}
]
}
],
"additionalAttributes": [
{}
],
"promotionMessages": [
{
"promoId": "6197ec46e836ff000952c667",
"threshold": 3,
"message": "Add another pair of shoes to get free socks!",
"locales": [
"en-US",
"en-GB"
],
"type": "PROXIMITY"
},
{
"promoId": "6197ec46e836ff000952c668",
"title": "Get free socks!",
"message": "Buy two pairs of shoes and get a pair of socks for free!",
"locales": [
"en-US",
"en-GB"
],
"pages": [
"PDP",
"CART"
],
"type": "POTENTIAL_DISCOUNT"
}
]
},
"audit": {
"userId": "62f5e25ca090100009c6e0f0",
"priceMethodType": "SurfaceArea_Square_Increment",
"quantity": 5,
"options": {
"length": 12,
"width": 10
},
"appliedAddons": [
"blind-motor"
]
}
}
]{
"status": "NOT_FOUND",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Validation error",
"debugMessage": "Either item ID or SKU is mandatory.",
"subErrors": [
{
"object": "promotionsEvaluationRequest",
"field": "items[0].quantity",
"rejectedValue": -2,
"message": "Must be greater than 0"
}
]
}{
"status": "NOT_FOUND",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Validation error",
"debugMessage": "Either item ID or SKU is mandatory.",
"subErrors": [
{
"object": "promotionsEvaluationRequest",
"field": "items[0].quantity",
"rejectedValue": -2,
"message": "Must be greater than 0"
}
]
}{
"status": "NOT_FOUND",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Validation error",
"debugMessage": "Either item ID or SKU is mandatory.",
"subErrors": [
{
"object": "promotionsEvaluationRequest",
"field": "items[0].quantity",
"rejectedValue": -2,
"message": "Must be greater than 0"
}
]
}{
"status": "NOT_FOUND",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Validation error",
"debugMessage": "Either item ID or SKU is mandatory.",
"subErrors": [
{
"object": "promotionsEvaluationRequest",
"field": "items[0].quantity",
"rejectedValue": -2,
"message": "Must be greater than 0"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The x-site-context header is a JSON object that contains information about the source you wish to pull from. The mandatory account is the 24 character identifier found in Copilot. The channel (Sales channel ID), stage (environment name), and date attributes can be used to further narrow the scope of your data source.
"{\"date\": \"2023-01-01T00:00:00.000Z\", \"channel\": 12, \"account\": \"1234abcd5678efgh9ijklmno\",\"stage\":\"production\"}"
Body
Prices conditions
Trace ID, used to trace logs
394823457
List of price list IDs which items or SKUs belong to
[100275, 100276]
A list of Stock Keeping Units (SKUs) for items whose prices needs to be retrieved. Specify either SKUs or itemIds. If both are provided, the SKU takes precedence.
[1000019501, 1000019502]
List of item IDs for items whose prices needs to be retrieved. Specify either SKUs or itemIds. If both are provided, the SKU takes precedence.
[111111, 222222]
User ID
"5e2cfb9b45570b000864c4b5"
Segment the user belongs to
Show child attributes
Show child attributes
{ "Customer Type": ["Wholesale"] }
true if the user logged in
false if the user is not logged in
true
List of channel ID from where the request is coming
List of channel ID from where the request is coming
[12, 15]
Date for which the prices are to be retrieved
yyyy-MM-ddThh:mm:ssZ"2019-08-24T14:15:22Z"
Various price parameters to calculate final price
Show child attributes
Show child attributes
true if audit is required. Response body will have an audit object with details about how the dynamic pricing engine obtained the result.
false if audit is not required.
true
Was this page helpful?
