Get items and limited children items - Fabric
Get items and limited children items
cURL
curl --request GET \
--url https://live.copilot.fabric.inc/api-product/v2/product \
--header 'Authorization: Bearer <token>' \
--header 'x-site-context: <x-site-context>'
Python
import requests
url = "https://live.copilot.fabric.inc/api-product/v2/product"
headers = {
"x-site-context": "<x-site-context>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {
method: 'GET',
headers: {'x-site-context': '<x-site-context>', Authorization: 'Bearer <token>'}
};
fetch('https://live.copilot.fabric.inc/api-product/v2/product', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [\
CURLOPT_URL => "https://live.copilot.fabric.inc/api-product/v2/product",\
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;
}
Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://live.copilot.fabric.inc/api-product/v2/product"
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))
}
Unirest (Java)
HttpResponse<String> response = Unirest.get("https://live.copilot.fabric.inc/api-product/v2/product")
.header("x-site-context", "<x-site-context>")
.header("Authorization", "Bearer <token>")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://live.copilot.fabric.inc/api-product/v2/product")
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 Examples
Successful Response (200)
{
"totalSize": 100,
"pageSize": 10,
"pages": 10,
"products": [
{
"sku": "MOBO-X570",
"itemId": 4,
"childrenSize": 0,
"type": "ITEM",
"status": true,
"categories": [
{
"id": "621c121bff2e4507c199b7cb",
"name": "electronics",
"nodeId": 30,
"breadcrumbs": [
{
"id": "621c10f3ff2e4507c199b66b",
"nodeId": 31,
"name": "PRIMARY",
"attributes": [
{
"id": "619a8ba6f1875f6dbcaf0521",
"name": "notes",
"description": "Notes for this particular category.",
"type": "TEXT",
"value": "Unable to fulfill demand.",
"mapping": "description"
}
]
}
]
}
],
"attributes": [
{
"id": "619a8ba6f1875f6dbcaf0521",
"name": "notes",
"description": "Notes for this particular category.",
"type": "TEXT",
"value": "Unable to fulfill demand.",
"mapping": "description"
}
]
}
]
}
Client Error Response (400)
{
"code": 400,
"message": "Client error"
}
Server Error Response (500)
{
"code": 500,
"message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}
Authorizations
- Authorization: S2S access token (JWT) from fabric Identity service (during Login)
- Header:
x-site-context: A JSON object that contains information about the source you wish to pull from.
- Mandatory
account is the 24 character identifier found in Copilot.
- Optional:
channel, stage, and date attributes for data filtering.
Query Parameters
- skus: Stock Keeping Units (SKUs).
- page: Page number to be retrieved.
- size: Number of records per page.
- status: Item status (ACTIVE or INACTIVE).
- type: Item type (ITEM or BUNDLE).
- createdAfter / createdBefore: Date filters for item creation.
- modifiedAfter / modifiedBefore: Date filters for item modifications.
- parentSku: Parent SKU to get its children items.