curl --request PUT \
--url https://api.fabric.inc/v3/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"products": [
{
"sku": "XP-123345",
"categoryId": "QWE1234CCVFDDERW21",
"type": "ITEM",
"id": "AASSBCC12334FCD12334V",
"isActive": true,
"attributes": [
{
"id": "6d7329dfd5288b0011332311",
"value": "blue"
}
],
"parentProduct": {
"id": "AASSBCC12334FCD12334V"
},
"bundleProducts": [
{
"sku": "XP-123345",
"quantity": 2
}
],
"variants": [
{
"id": "AASSBCC12334FCD12334V"
}
],
"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 = { "products": [
{
"sku": "XP-123345",
"categoryId": "QWE1234CCVFDDERW21",
"type": "ITEM",
"id": "AASSBCC12334FCD12334V",
"isActive": True,
"attributes": [
{
"id": "6d7329dfd5288b0011332311",
"value": "blue"
}
],
"parentProduct": { "id": "AASSBCC12334FCD12334V" },
"bundleProducts": [
{
"sku": "XP-123345",
"quantity": 2
}
],
"variants": [{ "id": "AASSBCC12334FCD12334V" }],
"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.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
products: [
{
sku: 'XP-123345',
categoryId: 'QWE1234CCVFDDERW21',
type: 'ITEM',
id: 'AASSBCC12334FCD12334V',
isActive: true,
attributes: [{id: '6d7329dfd5288b0011332311', value: 'blue'}],
parentProduct: {id: 'AASSBCC12334FCD12334V'},
bundleProducts: [{sku: 'XP-123345', quantity: 2}],
variants: [{id: 'AASSBCC12334FCD12334V'}],
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'products' => [
[
'sku' => 'XP-123345',
'categoryId' => 'QWE1234CCVFDDERW21',
'type' => 'ITEM',
'id' => 'AASSBCC12334FCD12334V',
'isActive' => true,
'attributes' => [
[
'id' => '6d7329dfd5288b0011332311',
'value' => 'blue'
]
],
'parentProduct' => [
'id' => 'AASSBCC12334FCD12334V'
],
'bundleProducts' => [
[
'sku' => 'XP-123345',
'quantity' => 2
]
],
'variants' => [
[
'id' => 'AASSBCC12334FCD12334V'
]
],
'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 \"products\": [\n {\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"id\": \"AASSBCC12334FCD12334V\",\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 \"variants\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\"\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 }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.fabric.inc/v3/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"products\": [\n {\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"id\": \"AASSBCC12334FCD12334V\",\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 \"variants\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\"\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 }\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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"products\": [\n {\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"id\": \"AASSBCC12334FCD12334V\",\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 \"variants\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\"\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 }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"success": [
{
"id": "AASSBCC12334FCD12334V",
"sku": "XP-123345"
}
],
"errors": [
{
"id": "AASSBCC12334FCD23456A",
"sku": "XP-23456",
"message": [
"Attribute ID 6d7329dfd5288b0011332311 can not be null"
]
}
]
}
]
}{
"message": "Request is invalid",
"type": "Bad request",
"errors": [
{
"type": "CLIENT_ERROR",
"message": "Invalid request. Unable to find or create product"
}
]
}{
"type": "UNAUTHORIZED_ERROR",
"message": "The requester is unauthorized"
}{
"type": "REQUEST_DENIED",
"message": "User doesn't have the required permission"
}{
"type": "CONFLICT",
"message": "Unable to update as there is a conflict with a unique attribute.",
"errors": [
{
"type": "CONFLICT",
"message": "<ID> already exists"
}
]
}{
"type": "PAYLOAD_LIMIT_EXCEEDED_ERROR",
"message": "Payload exceeds maximum configured size"
}{
"message": "Internal Server Error",
"type": "SERVER_ERROR"
}Update Multiple Products
With this endpoint, you can update details of multiple products, which could be items, variants, and bundles. Note:
1. When product type is Variant, it can be added either via SKU or ID.
2. When product type is Item, either the parentCategoryId or parentCategorySKU must be specified.
3. When product type is Bundle, the associated items or variants can be added either via SKU or via ID.
4. At least one product must be specified.
curl --request PUT \
--url https://api.fabric.inc/v3/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"products": [
{
"sku": "XP-123345",
"categoryId": "QWE1234CCVFDDERW21",
"type": "ITEM",
"id": "AASSBCC12334FCD12334V",
"isActive": true,
"attributes": [
{
"id": "6d7329dfd5288b0011332311",
"value": "blue"
}
],
"parentProduct": {
"id": "AASSBCC12334FCD12334V"
},
"bundleProducts": [
{
"sku": "XP-123345",
"quantity": 2
}
],
"variants": [
{
"id": "AASSBCC12334FCD12334V"
}
],
"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 = { "products": [
{
"sku": "XP-123345",
"categoryId": "QWE1234CCVFDDERW21",
"type": "ITEM",
"id": "AASSBCC12334FCD12334V",
"isActive": True,
"attributes": [
{
"id": "6d7329dfd5288b0011332311",
"value": "blue"
}
],
"parentProduct": { "id": "AASSBCC12334FCD12334V" },
"bundleProducts": [
{
"sku": "XP-123345",
"quantity": 2
}
],
"variants": [{ "id": "AASSBCC12334FCD12334V" }],
"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.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
products: [
{
sku: 'XP-123345',
categoryId: 'QWE1234CCVFDDERW21',
type: 'ITEM',
id: 'AASSBCC12334FCD12334V',
isActive: true,
attributes: [{id: '6d7329dfd5288b0011332311', value: 'blue'}],
parentProduct: {id: 'AASSBCC12334FCD12334V'},
bundleProducts: [{sku: 'XP-123345', quantity: 2}],
variants: [{id: 'AASSBCC12334FCD12334V'}],
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'products' => [
[
'sku' => 'XP-123345',
'categoryId' => 'QWE1234CCVFDDERW21',
'type' => 'ITEM',
'id' => 'AASSBCC12334FCD12334V',
'isActive' => true,
'attributes' => [
[
'id' => '6d7329dfd5288b0011332311',
'value' => 'blue'
]
],
'parentProduct' => [
'id' => 'AASSBCC12334FCD12334V'
],
'bundleProducts' => [
[
'sku' => 'XP-123345',
'quantity' => 2
]
],
'variants' => [
[
'id' => 'AASSBCC12334FCD12334V'
]
],
'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 \"products\": [\n {\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"id\": \"AASSBCC12334FCD12334V\",\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 \"variants\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\"\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 }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.fabric.inc/v3/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"products\": [\n {\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"id\": \"AASSBCC12334FCD12334V\",\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 \"variants\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\"\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 }\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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"products\": [\n {\n \"sku\": \"XP-123345\",\n \"categoryId\": \"QWE1234CCVFDDERW21\",\n \"type\": \"ITEM\",\n \"id\": \"AASSBCC12334FCD12334V\",\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 \"variants\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\"\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 }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"success": [
{
"id": "AASSBCC12334FCD12334V",
"sku": "XP-123345"
}
],
"errors": [
{
"id": "AASSBCC12334FCD23456A",
"sku": "XP-23456",
"message": [
"Attribute ID 6d7329dfd5288b0011332311 can not be null"
]
}
]
}
]
}{
"message": "Request is invalid",
"type": "Bad request",
"errors": [
{
"type": "CLIENT_ERROR",
"message": "Invalid request. Unable to find or create product"
}
]
}{
"type": "UNAUTHORIZED_ERROR",
"message": "The requester is unauthorized"
}{
"type": "REQUEST_DENIED",
"message": "User doesn't have the required permission"
}{
"type": "CONFLICT",
"message": "Unable to update as there is a conflict with a unique attribute.",
"errors": [
{
"type": "CONFLICT",
"message": "<ID> already exists"
}
]
}{
"type": "PAYLOAD_LIMIT_EXCEEDED_ERROR",
"message": "Payload exceeds maximum configured size"
}{
"message": "Internal Server Error",
"type": "SERVER_ERROR"
}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"
Query Parameters
Comma-separated locale codes of product. The service throws a 400 error if the locale isn't supported. Standard locales can be found at https://www.rfc-editor.org/rfc/rfc5646.
Note: The recommended way to get the locale is by invoking multi-channel service.
"fr-CA%2Cen-US"
Determines the version of the product applicable for this operation (endpoint action). If the status is DRAFT, only the Draft version of the product, if it exists, is considered for the operation.
DRAFT, LIVE "LIVE"
Body
1Show child attributes
Show child attributes
Response
OK
Add product response
Show child attributes
Show child attributes
Was this page helpful?
