curl --request POST \
--url https://api.fabric.inc/v3/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sku": "XP-123345",
"categoryId": "QWE1234CCVFDDERW21",
"type": "ITEM",
"status": "LIVE",
"isActive": true,
"attributes": [
{
"id": "6d7329dfd5288b0011332311",
"value": "blue"
}
],
"parentProduct": {
"id": "AASSBCC12334FCD12334V"
},
"bundleProducts": [
{
"sku": "XP-123345",
"quantity": 2
}
],
"localizedProperties": {
"en-US": {
"attributes": [
{
"id": "W123333RRTT555y1",
"value": "blue"
}
]
},
"en-IN": {
"attributes": [
{
"id": "W123333RRTT555AA",
"value": "blue"
}
]
}
}
}
'import requests
url = "https://api.fabric.inc/v3/products"
payload = {
"sku": "XP-123345",
"categoryId": "QWE1234CCVFDDERW21",
"type": "ITEM",
"status": "LIVE",
"isActive": True,
"attributes": [
{
"id": "6d7329dfd5288b0011332311",
"value": "blue"
}
],
"parentProduct": { "id": "AASSBCC12334FCD12334V" },
"bundleProducts": [
{
"sku": "XP-123345",
"quantity": 2
}
],
"localizedProperties": {
"en-US": { "attributes": [
{
"id": "W123333RRTT555y1",
"value": "blue"
}
] },
"en-IN": { "attributes": [
{
"id": "W123333RRTT555AA",
"value": "blue"
}
] }
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sku: 'XP-123345',
categoryId: 'QWE1234CCVFDDERW21',
type: 'ITEM',
status: 'LIVE',
isActive: true,
attributes: [{id: '6d7329dfd5288b0011332311', value: 'blue'}],
parentProduct: {id: 'AASSBCC12334FCD12334V'},
bundleProducts: [{sku: 'XP-123345', quantity: 2}],
localizedProperties: {
'en-US': {attributes: [{id: 'W123333RRTT555y1', value: 'blue'}]},
'en-IN': {attributes: [{id: 'W123333RRTT555AA', value: 'blue'}]}
}
})
};
fetch('https://api.fabric.inc/v3/products', 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://api.fabric.inc/v3/products",
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([
'sku' => 'XP-123345',
'categoryId' => 'QWE1234CCVFDDERW21',
'type' => 'ITEM',
'status' => 'LIVE',
'isActive' => true,
'attributes' => [
[
'id' => '6d7329dfd5288b0011332311',
'value' => 'blue'
]
],
'parentProduct' => [
'id' => 'AASSBCC12334FCD12334V'
],
'bundleProducts' => [
[
'sku' => 'XP-123345',
'quantity' => 2
]
],
'localizedProperties' => [
'en-US' => [
'attributes' => [
[
'id' => 'W123333RRTT555y1',
'value' => 'blue'
]
]
],
'en-IN' => [
'attributes' => [
[
'id' => 'W123333RRTT555AA',
'value' => 'blue'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.fabric.inc/v3/products"
payload := strings.NewReader("{\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"status\": \"LIVE\",\n \"isActive\": true,\n \"attributes\": [\n {\n \"id\": \"6d7329dfd5288b0011332311\",\n \"value\": \"blue\"\n }\n ],\n \"parentProduct\": {\n \"id\": \"AASSBCC12334FCD12334V\"\n },\n \"bundleProducts\": [\n {\n \"sku\": \"XP-123345\",\n \"quantity\": 2\n }\n ],\n \"localizedProperties\": {\n \"en-US\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555y1\",\n \"value\": \"blue\"\n }\n ]\n },\n \"en-IN\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555AA\",\n \"value\": \"blue\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.fabric.inc/v3/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"status\": \"LIVE\",\n \"isActive\": true,\n \"attributes\": [\n {\n \"id\": \"6d7329dfd5288b0011332311\",\n \"value\": \"blue\"\n }\n ],\n \"parentProduct\": {\n \"id\": \"AASSBCC12334FCD12334V\"\n },\n \"bundleProducts\": [\n {\n \"sku\": \"XP-123345\",\n \"quantity\": 2\n }\n ],\n \"localizedProperties\": {\n \"en-US\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555y1\",\n \"value\": \"blue\"\n }\n ]\n },\n \"en-IN\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555AA\",\n \"value\": \"blue\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"status\": \"LIVE\",\n \"isActive\": true,\n \"attributes\": [\n {\n \"id\": \"6d7329dfd5288b0011332311\",\n \"value\": \"blue\"\n }\n ],\n \"parentProduct\": {\n \"id\": \"AASSBCC12334FCD12334V\"\n },\n \"bundleProducts\": [\n {\n \"sku\": \"XP-123345\",\n \"quantity\": 2\n }\n ],\n \"localizedProperties\": {\n \"en-US\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555y1\",\n \"value\": \"blue\"\n }\n ]\n },\n \"en-IN\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555AA\",\n \"value\": \"blue\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "5g7329dfd5288b00113323p7",
"sku": "QWERTTY56DDFFVVV",
"type": "ITEM",
"isActive": true,
"hasDraft": true,
"hasLive": true,
"status": "LIVE",
"attributes": [
{
"id": "227329dfd5288b0011332315",
"name": "Color",
"type": "string",
"isDeleted": false,
"value": "blue",
"isInherited": true
}
],
"localizedProperties": {
"en-US": {
"attributes": [
{
"id": "637329dfd5288b0011332354",
"name": "Color",
"type": "string",
"isDeleted": false,
"value": "blue",
"isInherited": true
}
]
},
"en-IN": {
"attributes": [
{
"id": "8f7329dfd5288b0011332334",
"name": "Colour",
"type": "string",
"isDeleted": false,
"value": "blue",
"isInherited": true
}
]
}
},
"variants": [
{
"id": "967329dfd5288b0011332356"
}
],
"categoryId": "7f7329dfd5288b0011332378",
"createdAt": "2021-09-14T22:10:30.618Z",
"updatedAt": "2021-09-14T22:10:30.618Z"
}Add Product
At fabric, the term products refers to items, variants, and/or bundles.
curl --request POST \
--url https://api.fabric.inc/v3/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sku": "XP-123345",
"categoryId": "QWE1234CCVFDDERW21",
"type": "ITEM",
"status": "LIVE",
"isActive": true,
"attributes": [
{
"id": "6d7329dfd5288b0011332311",
"value": "blue"
}
],
"parentProduct": {
"id": "AASSBCC12334FCD12334V"
},
"bundleProducts": [
{
"sku": "XP-123345",
"quantity": 2
}
],
"localizedProperties": {
"en-US": {
"attributes": [
{
"id": "W123333RRTT555y1",
"value": "blue"
}
]
},
"en-IN": {
"attributes": [
{
"id": "W123333RRTT555AA",
"value": "blue"
}
]
}
}
}
'import requests
url = "https://api.fabric.inc/v3/products"
payload = {
"sku": "XP-123345",
"categoryId": "QWE1234CCVFDDERW21",
"type": "ITEM",
"status": "LIVE",
"isActive": True,
"attributes": [
{
"id": "6d7329dfd5288b0011332311",
"value": "blue"
}
],
"parentProduct": { "id": "AASSBCC12334FCD12334V" },
"bundleProducts": [
{
"sku": "XP-123345",
"quantity": 2
}
],
"localizedProperties": {
"en-US": { "attributes": [
{
"id": "W123333RRTT555y1",
"value": "blue"
}
] },
"en-IN": { "attributes": [
{
"id": "W123333RRTT555AA",
"value": "blue"
}
] }
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sku: 'XP-123345',
categoryId: 'QWE1234CCVFDDERW21',
type: 'ITEM',
status: 'LIVE',
isActive: true,
attributes: [{id: '6d7329dfd5288b0011332311', value: 'blue'}],
parentProduct: {id: 'AASSBCC12334FCD12334V'},
bundleProducts: [{sku: 'XP-123345', quantity: 2}],
localizedProperties: {
'en-US': {attributes: [{id: 'W123333RRTT555y1', value: 'blue'}]},
'en-IN': {attributes: [{id: 'W123333RRTT555AA', value: 'blue'}]}
}
})
};
fetch('https://api.fabric.inc/v3/products', 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://api.fabric.inc/v3/products",
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([
'sku' => 'XP-123345',
'categoryId' => 'QWE1234CCVFDDERW21',
'type' => 'ITEM',
'status' => 'LIVE',
'isActive' => true,
'attributes' => [
[
'id' => '6d7329dfd5288b0011332311',
'value' => 'blue'
]
],
'parentProduct' => [
'id' => 'AASSBCC12334FCD12334V'
],
'bundleProducts' => [
[
'sku' => 'XP-123345',
'quantity' => 2
]
],
'localizedProperties' => [
'en-US' => [
'attributes' => [
[
'id' => 'W123333RRTT555y1',
'value' => 'blue'
]
]
],
'en-IN' => [
'attributes' => [
[
'id' => 'W123333RRTT555AA',
'value' => 'blue'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.fabric.inc/v3/products"
payload := strings.NewReader("{\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"status\": \"LIVE\",\n \"isActive\": true,\n \"attributes\": [\n {\n \"id\": \"6d7329dfd5288b0011332311\",\n \"value\": \"blue\"\n }\n ],\n \"parentProduct\": {\n \"id\": \"AASSBCC12334FCD12334V\"\n },\n \"bundleProducts\": [\n {\n \"sku\": \"XP-123345\",\n \"quantity\": 2\n }\n ],\n \"localizedProperties\": {\n \"en-US\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555y1\",\n \"value\": \"blue\"\n }\n ]\n },\n \"en-IN\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555AA\",\n \"value\": \"blue\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.fabric.inc/v3/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"status\": \"LIVE\",\n \"isActive\": true,\n \"attributes\": [\n {\n \"id\": \"6d7329dfd5288b0011332311\",\n \"value\": \"blue\"\n }\n ],\n \"parentProduct\": {\n \"id\": \"AASSBCC12334FCD12334V\"\n },\n \"bundleProducts\": [\n {\n \"sku\": \"XP-123345\",\n \"quantity\": 2\n }\n ],\n \"localizedProperties\": {\n \"en-US\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555y1\",\n \"value\": \"blue\"\n }\n ]\n },\n \"en-IN\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555AA\",\n \"value\": \"blue\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"status\": \"LIVE\",\n \"isActive\": true,\n \"attributes\": [\n {\n \"id\": \"6d7329dfd5288b0011332311\",\n \"value\": \"blue\"\n }\n ],\n \"parentProduct\": {\n \"id\": \"AASSBCC12334FCD12334V\"\n },\n \"bundleProducts\": [\n {\n \"sku\": \"XP-123345\",\n \"quantity\": 2\n }\n ],\n \"localizedProperties\": {\n \"en-US\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555y1\",\n \"value\": \"blue\"\n }\n ]\n },\n \"en-IN\": {\n \"attributes\": [\n {\n \"id\": \"W123333RRTT555AA\",\n \"value\": \"blue\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "5g7329dfd5288b00113323p7",
"sku": "QWERTTY56DDFFVVV",
"type": "ITEM",
"isActive": true,
"hasDraft": true,
"hasLive": true,
"status": "LIVE",
"attributes": [
{
"id": "227329dfd5288b0011332315",
"name": "Color",
"type": "string",
"isDeleted": false,
"value": "blue",
"isInherited": true
}
],
"localizedProperties": {
"en-US": {
"attributes": [
{
"id": "637329dfd5288b0011332354",
"name": "Color",
"type": "string",
"isDeleted": false,
"value": "blue",
"isInherited": true
}
]
},
"en-IN": {
"attributes": [
{
"id": "8f7329dfd5288b0011332334",
"name": "Colour",
"type": "string",
"isDeleted": false,
"value": "blue",
"isInherited": true
}
]
}
},
"variants": [
{
"id": "967329dfd5288b0011332356"
}
],
"categoryId": "7f7329dfd5288b0011332378",
"createdAt": "2021-09-14T22:10:30.618Z",
"updatedAt": "2021-09-14T22:10:30.618Z"
}Authorizations
S2S access token (JWT) from fabric Identity service (during Login)
Headers
A header used by fabric to identify the tenant making the request. You must include tenant id in the authentication header for an API request to access any of fabric’s endpoints. You can retrieve the tenant id , which is also called account id, from Copilot. This header is required.
"517fa9dfd42d8b00g1o3k312"
Unique request ID
"263e731c-45c8-11ed-b878-0242ac120002"
Body
Request body for creating Items, Variants and Bundles
Unique product ID that maps to fabric's standard attribute called SKU.
Note: sku shouldn't include ; or =
^[^;=]*$"XP-123345"
24-character system-generated category ID
"QWE1234CCVFDDERW21"
Supported product types
ITEM, VARIANT, BUNDLE "ITEM"
Represents the current status of product. This value takes precedence over isActive if both are sent in the request.
DRAFT, LIVE "LIVE"
Determines if the Product is published or unpublished. Status parameter takes precedence
true
Array of product attributes
Show child attributes
Show child attributes
ID or SKU of parent product
- Option 1
- Option 2
Show child attributes
Show child attributes
- Option 1 · object[]
- Option 2 · object[]
Show child attributes
Show child attributes
Show child attributes
Show child attributes
{
"en-US": {
"attributes": [
{ "id": "W123333RRTT555y1", "value": "blue" }
]
},
"en-IN": {
"attributes": [
{ "id": "W123333RRTT555AA", "value": "blue" }
]
}
}
Response
OK
Details of Item by ID
Product ID
"AASSBCC12334FCD12334V"
Unique product ID that maps to fabric's standard attribute called SKU.
Note: sku shouldn't include ; or =
^[^;=]*$"XP-123345"
Supported product types
ITEM, VARIANT, BUNDLE "ITEM"
true: Product is active
false: Product is inactive
true
true: Product has a Draft version
false: Product doesn't have a Draft version
true
true: Product has a Live version
false: Product doesn't have a Live version
true
Represents the current status of product. This value takes precedence over isActive if both are sent in the request.
DRAFT, LIVE "LIVE"
Attributes of product
Show child attributes
Show child attributes
Localized attribute names
Show child attributes
Show child attributes
{
"en-US": {
"attributes": [
{
"id": "4e7329dfd5288b0011332366",
"name": "Color",
"type": "string",
"isDeleted": false,
"value": "blue",
"isInherited": true
}
]
}
}
Parent item ID of the Variant
Show child attributes
Show child attributes
Product variants by ID
Show child attributes
Show child attributes
24-character system-generated category ID of product
"6h7329dfd5288b001133231d"
Items or variants that are part of Bundle by ID
Show child attributes
Show child attributes
Time of product creation (UTC)
"2021-09-14T22:10:30.618Z"
Time of last update to product (UTC)
"2021-09-14T22:10:30.618Z"
Was this page helpful?
