curl --request PUT \
--url https://api.fabric.inc/v3/collections/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Color",
"isLocalizable": true,
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"attributes": [
{
"id": "78184766610c0e32a86d8757",
"value": "blue"
}
],
"categoryIdsIncluded": [
"64184766610c0e32a86d8758",
"917329dfd5288b0011332300"
],
"categoryIdsExcluded": [
"66184766610c0e32a86d8722",
"41184766610c0e32a86d8778"
],
"isActive": true,
"productAttributeFilters": [
{
"attributeId": "53184766610c0e32a86d875",
"condition": "EQUALS",
"value": 2
}
]
}
'import requests
url = "https://api.fabric.inc/v3/collections/{id}"
payload = {
"name": "Color",
"isLocalizable": True,
"localizedProperties": {
"en-US": { "name": "Color" },
"en-IN": { "name": "Colour" }
},
"attributes": [
{
"id": "78184766610c0e32a86d8757",
"value": "blue"
}
],
"categoryIdsIncluded": ["64184766610c0e32a86d8758", "917329dfd5288b0011332300"],
"categoryIdsExcluded": ["66184766610c0e32a86d8722", "41184766610c0e32a86d8778"],
"isActive": True,
"productAttributeFilters": [
{
"attributeId": "53184766610c0e32a86d875",
"condition": "EQUALS",
"value": 2
}
]
}
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({
name: 'Color',
isLocalizable: true,
localizedProperties: {'en-US': {name: 'Color'}, 'en-IN': {name: 'Colour'}},
attributes: [{id: '78184766610c0e32a86d8757', value: 'blue'}],
categoryIdsIncluded: ['64184766610c0e32a86d8758', '917329dfd5288b0011332300'],
categoryIdsExcluded: ['66184766610c0e32a86d8722', '41184766610c0e32a86d8778'],
isActive: true,
productAttributeFilters: [{attributeId: '53184766610c0e32a86d875', condition: 'EQUALS', value: 2}]
})
};
fetch('https://api.fabric.inc/v3/collections/{id}', 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/collections/{id}",
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([
'name' => 'Color',
'isLocalizable' => true,
'localizedProperties' => [
'en-US' => [
'name' => 'Color'
],
'en-IN' => [
'name' => 'Colour'
]
],
'attributes' => [
[
'id' => '78184766610c0e32a86d8757',
'value' => 'blue'
]
],
'categoryIdsIncluded' => [
'64184766610c0e32a86d8758',
'917329dfd5288b0011332300'
],
'categoryIdsExcluded' => [
'66184766610c0e32a86d8722',
'41184766610c0e32a86d8778'
],
'isActive' => true,
'productAttributeFilters' => [
[
'attributeId' => '53184766610c0e32a86d875',
'condition' => 'EQUALS',
'value' => 2
]
]
]),
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/collections/{id}"
payload := strings.NewReader("{\n \"name\": \"Color\",\n \"isLocalizable\": true,\n \"localizedProperties\": {\n \"en-US\": {\n \"name\": \"Color\"\n },\n \"en-IN\": {\n \"name\": \"Colour\"\n }\n },\n \"attributes\": [\n {\n \"id\": \"78184766610c0e32a86d8757\",\n \"value\": \"blue\"\n }\n ],\n \"categoryIdsIncluded\": [\n \"64184766610c0e32a86d8758\",\n \"917329dfd5288b0011332300\"\n ],\n \"categoryIdsExcluded\": [\n \"66184766610c0e32a86d8722\",\n \"41184766610c0e32a86d8778\"\n ],\n \"isActive\": true,\n \"productAttributeFilters\": [\n {\n \"attributeId\": \"53184766610c0e32a86d875\",\n \"condition\": \"EQUALS\",\n \"value\": 2\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/collections/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Color\",\n \"isLocalizable\": true,\n \"localizedProperties\": {\n \"en-US\": {\n \"name\": \"Color\"\n },\n \"en-IN\": {\n \"name\": \"Colour\"\n }\n },\n \"attributes\": [\n {\n \"id\": \"78184766610c0e32a86d8757\",\n \"value\": \"blue\"\n }\n ],\n \"categoryIdsIncluded\": [\n \"64184766610c0e32a86d8758\",\n \"917329dfd5288b0011332300\"\n ],\n \"categoryIdsExcluded\": [\n \"66184766610c0e32a86d8722\",\n \"41184766610c0e32a86d8778\"\n ],\n \"isActive\": true,\n \"productAttributeFilters\": [\n {\n \"attributeId\": \"53184766610c0e32a86d875\",\n \"condition\": \"EQUALS\",\n \"value\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/collections/{id}")
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 \"name\": \"Color\",\n \"isLocalizable\": true,\n \"localizedProperties\": {\n \"en-US\": {\n \"name\": \"Color\"\n },\n \"en-IN\": {\n \"name\": \"Colour\"\n }\n },\n \"attributes\": [\n {\n \"id\": \"78184766610c0e32a86d8757\",\n \"value\": \"blue\"\n }\n ],\n \"categoryIdsIncluded\": [\n \"64184766610c0e32a86d8758\",\n \"917329dfd5288b0011332300\"\n ],\n \"categoryIdsExcluded\": [\n \"66184766610c0e32a86d8722\",\n \"41184766610c0e32a86d8778\"\n ],\n \"isActive\": true,\n \"productAttributeFilters\": [\n {\n \"attributeId\": \"53184766610c0e32a86d875\",\n \"condition\": \"EQUALS\",\n \"value\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "55184766610c0e32a86d8759",
"name": "Color",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isRoot": true,
"isActive": false,
"attributes": [
{
"id": "64184766610c0e32a86d8758",
"name": "color",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isInherited": true,
"type": "TEXT",
"validation": {
"dateFormat": "MM-DD-YYYY"
},
"value": "blue"
}
],
"categoriesIncluded": [
{
"id": "64184766610c0e32a86d8758",
"name": "Chairs",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true
}
],
"categoriesExcluded": [
{
"id": "64184766610c0e32a86d8758",
"name": "Chairs",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true
}
],
"productAttributeFilters": [
{
"attributeId": "53184766610c0e32a86d875",
"name": "Mobile name",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"condition": "EQUALS",
"value": 2
}
],
"children": [
{
"id": "78184766610c0e32a86d8757",
"name": "Chairs",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isLeaf": false
}
],
"updatedBy": "test@eamil.com",
"updatedAt": "2023-04-20T10:24:36.162Z",
"createdAt": "2021-04-20T10:24:36.162Z"
}{
"message": "Request was invalid",
"type": "Bad request",
"errors": [
{
"type": "CLIENT_ERROR",
"message": "Invalid request"
}
]
}{
"message": "The requester is unauthorized",
"type": "UNAUTHORIZED_ERROR"
}{
"type": "REQUEST_DENIED",
"message": "User doesn't have the required permission"
}{
"type": "NOT_FOUND",
"message": "Resource not found"
}{
"type": "PAYLOAD_LIMIT_EXCEEDED_ERROR",
"message": "The payload exceeds maximum configured size"
}{
"type": "SERVER_ERROR",
"message": "Internal Server Error"
}Update Collection
With this endpoint, you can update details of a single collection, such as add or remove sub-collections, add validation rules for attributes, reorder collections, and more. Note:
1. This endpoint replaces the existing details.
2. To avoid impacting the entire data, for minor updates, use the Partially update collection endpoint instead - PATCH /collections/{id}.
curl --request PUT \
--url https://api.fabric.inc/v3/collections/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Color",
"isLocalizable": true,
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"attributes": [
{
"id": "78184766610c0e32a86d8757",
"value": "blue"
}
],
"categoryIdsIncluded": [
"64184766610c0e32a86d8758",
"917329dfd5288b0011332300"
],
"categoryIdsExcluded": [
"66184766610c0e32a86d8722",
"41184766610c0e32a86d8778"
],
"isActive": true,
"productAttributeFilters": [
{
"attributeId": "53184766610c0e32a86d875",
"condition": "EQUALS",
"value": 2
}
]
}
'import requests
url = "https://api.fabric.inc/v3/collections/{id}"
payload = {
"name": "Color",
"isLocalizable": True,
"localizedProperties": {
"en-US": { "name": "Color" },
"en-IN": { "name": "Colour" }
},
"attributes": [
{
"id": "78184766610c0e32a86d8757",
"value": "blue"
}
],
"categoryIdsIncluded": ["64184766610c0e32a86d8758", "917329dfd5288b0011332300"],
"categoryIdsExcluded": ["66184766610c0e32a86d8722", "41184766610c0e32a86d8778"],
"isActive": True,
"productAttributeFilters": [
{
"attributeId": "53184766610c0e32a86d875",
"condition": "EQUALS",
"value": 2
}
]
}
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({
name: 'Color',
isLocalizable: true,
localizedProperties: {'en-US': {name: 'Color'}, 'en-IN': {name: 'Colour'}},
attributes: [{id: '78184766610c0e32a86d8757', value: 'blue'}],
categoryIdsIncluded: ['64184766610c0e32a86d8758', '917329dfd5288b0011332300'],
categoryIdsExcluded: ['66184766610c0e32a86d8722', '41184766610c0e32a86d8778'],
isActive: true,
productAttributeFilters: [{attributeId: '53184766610c0e32a86d875', condition: 'EQUALS', value: 2}]
})
};
fetch('https://api.fabric.inc/v3/collections/{id}', 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/collections/{id}",
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([
'name' => 'Color',
'isLocalizable' => true,
'localizedProperties' => [
'en-US' => [
'name' => 'Color'
],
'en-IN' => [
'name' => 'Colour'
]
],
'attributes' => [
[
'id' => '78184766610c0e32a86d8757',
'value' => 'blue'
]
],
'categoryIdsIncluded' => [
'64184766610c0e32a86d8758',
'917329dfd5288b0011332300'
],
'categoryIdsExcluded' => [
'66184766610c0e32a86d8722',
'41184766610c0e32a86d8778'
],
'isActive' => true,
'productAttributeFilters' => [
[
'attributeId' => '53184766610c0e32a86d875',
'condition' => 'EQUALS',
'value' => 2
]
]
]),
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/collections/{id}"
payload := strings.NewReader("{\n \"name\": \"Color\",\n \"isLocalizable\": true,\n \"localizedProperties\": {\n \"en-US\": {\n \"name\": \"Color\"\n },\n \"en-IN\": {\n \"name\": \"Colour\"\n }\n },\n \"attributes\": [\n {\n \"id\": \"78184766610c0e32a86d8757\",\n \"value\": \"blue\"\n }\n ],\n \"categoryIdsIncluded\": [\n \"64184766610c0e32a86d8758\",\n \"917329dfd5288b0011332300\"\n ],\n \"categoryIdsExcluded\": [\n \"66184766610c0e32a86d8722\",\n \"41184766610c0e32a86d8778\"\n ],\n \"isActive\": true,\n \"productAttributeFilters\": [\n {\n \"attributeId\": \"53184766610c0e32a86d875\",\n \"condition\": \"EQUALS\",\n \"value\": 2\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/collections/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Color\",\n \"isLocalizable\": true,\n \"localizedProperties\": {\n \"en-US\": {\n \"name\": \"Color\"\n },\n \"en-IN\": {\n \"name\": \"Colour\"\n }\n },\n \"attributes\": [\n {\n \"id\": \"78184766610c0e32a86d8757\",\n \"value\": \"blue\"\n }\n ],\n \"categoryIdsIncluded\": [\n \"64184766610c0e32a86d8758\",\n \"917329dfd5288b0011332300\"\n ],\n \"categoryIdsExcluded\": [\n \"66184766610c0e32a86d8722\",\n \"41184766610c0e32a86d8778\"\n ],\n \"isActive\": true,\n \"productAttributeFilters\": [\n {\n \"attributeId\": \"53184766610c0e32a86d875\",\n \"condition\": \"EQUALS\",\n \"value\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/collections/{id}")
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 \"name\": \"Color\",\n \"isLocalizable\": true,\n \"localizedProperties\": {\n \"en-US\": {\n \"name\": \"Color\"\n },\n \"en-IN\": {\n \"name\": \"Colour\"\n }\n },\n \"attributes\": [\n {\n \"id\": \"78184766610c0e32a86d8757\",\n \"value\": \"blue\"\n }\n ],\n \"categoryIdsIncluded\": [\n \"64184766610c0e32a86d8758\",\n \"917329dfd5288b0011332300\"\n ],\n \"categoryIdsExcluded\": [\n \"66184766610c0e32a86d8722\",\n \"41184766610c0e32a86d8778\"\n ],\n \"isActive\": true,\n \"productAttributeFilters\": [\n {\n \"attributeId\": \"53184766610c0e32a86d875\",\n \"condition\": \"EQUALS\",\n \"value\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "55184766610c0e32a86d8759",
"name": "Color",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isRoot": true,
"isActive": false,
"attributes": [
{
"id": "64184766610c0e32a86d8758",
"name": "color",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isInherited": true,
"type": "TEXT",
"validation": {
"dateFormat": "MM-DD-YYYY"
},
"value": "blue"
}
],
"categoriesIncluded": [
{
"id": "64184766610c0e32a86d8758",
"name": "Chairs",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true
}
],
"categoriesExcluded": [
{
"id": "64184766610c0e32a86d8758",
"name": "Chairs",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true
}
],
"productAttributeFilters": [
{
"attributeId": "53184766610c0e32a86d875",
"name": "Mobile name",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"condition": "EQUALS",
"value": 2
}
],
"children": [
{
"id": "78184766610c0e32a86d8757",
"name": "Chairs",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isLeaf": false
}
],
"updatedBy": "test@eamil.com",
"updatedAt": "2023-04-20T10:24:36.162Z",
"createdAt": "2021-04-20T10:24:36.162Z"
}{
"message": "Request was invalid",
"type": "Bad request",
"errors": [
{
"type": "CLIENT_ERROR",
"message": "Invalid request"
}
]
}{
"message": "The requester is unauthorized",
"type": "UNAUTHORIZED_ERROR"
}{
"type": "REQUEST_DENIED",
"message": "User doesn't have the required permission"
}{
"type": "NOT_FOUND",
"message": "Resource not found"
}{
"type": "PAYLOAD_LIMIT_EXCEEDED_ERROR",
"message": "The payload exceeds maximum configured size"
}{
"type": "SERVER_ERROR",
"message": "Internal Server Error"
}Authorizations
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"
Body
Details to update collection
Details to update collection
Response
OK
Collection details
Was this page helpful?
