Get all price lists - Fabric
Get all price lists
cURL
curl --request GET \
--url 'https://live.copilot.fabric.inc/api-offers/price-list?limit=10&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-list?limit=10&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-list?limit=10&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-list?limit=10&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-list?limit=10&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-list?limit=10&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-list?limit=10&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>'
equest["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body
Status Codes
- 200
- 400
- 500
Response Example
{
"query": {
"limit": 10,
"count": 150,
"offset": 0
},
"data": [
{
"_id": "614b58924e92f6861ac9d43b",
"priceListId": 10000003,
"name": "BuildMuscles-CONTRACT123",
"isDefault": false,
"currency": "USD",
"startDate": "2021-05-04T09:23:51.459Z",
"endDate": "2021-06-09T09:23:51.459Z",
"deleted": false,
"createdAt": "2020-12-14T12:15:43.646Z",
"updatedAt": "2021-12-14T12:15:43.646Z"
}
]
}
{
"code": "BAD_REQUEST",
"message": "Bad Request"
}
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error."
}
Authorization
Authorization
- Type: string
- Location: header
- Required: Yes
- Description: Bearer authentication header of the form
Bearer <token>, where<token>is your auth token.
Headers
x-site-context
- Type: string
- Location: header
- Required: Yes
- Description: The
x-site-contextheader is a JSON object that contains information about the source you wish to pull from. The mandatoryaccountis the 24 character identifier found in Copilot. Thechannel(Sales channel ID),stage(environment name), anddateattributes can be used to further narrow the scope of your data source.
Example:
{"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account": "1234abcd5678efgh9ijklmno","stage":"production"}
Query Parameters
- limit: number (default: 10)
- Description: The maximum number of records per page. Required range:
x >= 0
- Description: The maximum number of records per page. Required range:
- offset: number (default: 0)
- Description: The number of records to skip before returning records. For example, when offset is 20 and limit is 10, this endpoint returns records from 21 to 30. Required range:
x >= 0
- Description: The number of records to skip before returning records. For example, when offset is 20 and limit is 10, this endpoint returns records from 21 to 30. Required range:
- sortBy: enum
(default: updatedAt) - Description: Field by which you want to sort the records
- Options:
updatedAt,name,priceListId
- sortOrder: enum
(default: desc) - Description: Sorting order of the records
- Options:
asc,desc
- filter: enum
- Options:
not_expired
- Options:
- isDefault: enum
- Options:
true,false
- Options:
Response
- Status Code 200: application/json
- Description: OK
- Response Example:
{
"query": {
"limit": 10,
"count": 150,
"offset": 0
},
"data": []
}