Get items and children items - Fabric
Get items and children items
Sample cURL Request
curl --request GET \
--url https://live.copilot.fabric.inc/api-product/v1/product \
--header 'Authorization: Bearer <token>' \
--header 'x-site-context: <x-site-context>'
Sample Python Request
import requests
url = "https://live.copilot.fabric.inc/api-product/v1/product"
headers = {
"x-site-context": "<x-site-context>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)
Sample JavaScript Request
const options = {
method: 'GET',
headers: {'x-site-context': '<x-site-context>', Authorization: 'Bearer <token>'}
};
fetch('https://live.copilot.fabric.inc/api-product/v1/product', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
Sample PHP Request
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://live.copilot.fabric.inc/api-product/v1/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;
}
Sample Go Request
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://live.copilot.fabric.inc/api-product/v1/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))
}
Sample Unirest Request
HttpResponse<String> response = Unirest.get("https://live.copilot.fabric.inc/api-product/v1/product")
.header("x-site-context", "<x-site-context>")
.header("Authorization", "Bearer <token>")
.asString();
Sample Ruby Request
require 'uri'
require 'net/http'
url = URI("https://live.copilot.fabric.inc/api-product/v1/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
Example Response 200
{
"totalSize": 100,
"pageSize": 10,
"pages": 10,
"products": [
{
"sku": "MOBO-X570",
"itemId": 4,
"children": [
{
"sku": "<string>",
"attributes": [
{
"id": "619a8ba6f1875f6dbcaf0521",
"name": "notes",
"description": "Notes for this particular category.",
"type": "TEXT",
"value": "Unable to fulfill demand.",
"mapping": "description"
}
]
}
],
"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"
}
],
"createdOn": "2022-03-07T22:50:10.668Z",
"modifiedOn": "2022-03-07T22:52:01.720Z"
}
]
}
Example Response 400
{
"code": 400,
"message": "Client error"
}
Example Response 500
{
"code": 500,
"message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}
Authorization Required
- Authorization:
string, header, required - S2S access token (JWT) from fabric Identity service (during Login)
Headers
- x-site-context:
string, required - The x-site-context header is a JSON object that contains information about the source.