Get all prices - Fabric
Get all prices
cURL
curl --request GET \
--url 'https://live.copilot.fabric.inc/api-offers/price?limit=10&page=1&sortBy=updatedAt&sortOrder=desc' \
--header 'Authorization: Bearer <token>' \
--header 'x-site-context: <x-site-context>'
import requests
url = "https://live.copilot.fabric.inc/api-offers/price?limit=10&page=1&sortBy=updatedAt&sortOrder=desc"
headers = {
"x-site-context": "<x-site-context>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)
const options = {
method: 'GET',
headers: {'x-site-context': '<x-site-context>', Authorization: 'Bearer <token>'}
};
fetch('https://live.copilot.fabric.inc/api-offers/price?limit=10&page=1&sortBy=updatedAt&sortOrder=desc', 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/api-offers/price?limit=10&page=1&sortBy=updatedAt&sortOrder=desc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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"
"net/http"
"io"
)
func main() {
url := "https://live.copilot.fabric.inc/api-offers/price?limit=10&page=1&sortBy=updatedAt&sortOrder=desc"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-site-context", "<x-site-context>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.get("https://live.copilot.fabric.inc/api-offers/price?limit=10&page=1&sortBy=updatedAt&sortOrder=desc")
.header("x-site-context", "<x-site-context>")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'
url = URI("https://live.copilot.fabric.inc/api-offers/price?limit=10&page=1&sortBy=updatedAt&sortOrder=desc")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-site-context"] = '<x-site-context>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body
Response Codes
200
400
500
Response Structure
{
"query": {
"limit": 10,
"count": 8,
"page": 1
},
"prices": [
{
"_id": "616e011037a3810012345678",
"isSoftDeleted": false,
"itemId": 1000000051,
"itemSku": "SKU123456",
"offerId": 2386,
"createdAt": "2020-02-02T17:22:48.570Z",
"updatedAt": "2020-02-02T17:22:48.570Z",
"job": false,
"priceListId": 100000,
"offers": [
{
"kind": 12,
"channel": 12,
"startDate": "2020-02-03T17:22:48.570Z",
"endDate": "2020-02-05T17:22:48.570Z",
"price": {
"base": 299,
"sale": 199,
"cost": 149,
"currency": "USD"
},
"offerCode": 130283400,
"range": [
{
"minQuantity": 3,
"price": 299,
"maxQuantity": "Infinity",
"width": [
{
"minQuantity": 1,
"maxQuantity": "Infinity",
"price": 20.75
}
]
}
],
"priceAttributes": [
{
"_id": "614dc5b0af8ee70008698202",
"id": "614dc5b0af8ee70008698202"
}
],
"priceMethodType": "Range-Base"
}
]
}
]
}
{
"code": "BAD_REQUEST",
"message": "Bad Request"
}
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error."
}
Authorizations
- Authorization:
Bearer <token>
Headers
- x-site-context: a JSON object containing information about the source you wish to pull from. Example:
{"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account": "1234abcd5678efgh9ijklmno","stage":"production"}
Query Parameters
- limit: Maximum number of records per page (default: 10).
- page: Page number to retrieve (default: 1).
- priceListId: ID of the price list for which you want to get the price details.
- sortBy: Field to sort the records (default:
updatedAt). Available options:itemId,priceListId,updatedAt. - sortOrder: Sorting order (default:
desc). Available options:asc,desc.