curl --request POST \
--url https://api.fabric.inc/v3/collections/actions/copy-category \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"parentCollectionId": "64184766610c0e32a86d8758",
"categoryId": "917329dfd5288b0011332300"
}
'import requests
url = "https://api.fabric.inc/v3/collections/actions/copy-category"
payload = {
"parentCollectionId": "64184766610c0e32a86d8758",
"categoryId": "917329dfd5288b0011332300"
}
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({
parentCollectionId: '64184766610c0e32a86d8758',
categoryId: '917329dfd5288b0011332300'
})
};
fetch('https://api.fabric.inc/v3/collections/actions/copy-category', 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/actions/copy-category",
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([
'parentCollectionId' => '64184766610c0e32a86d8758',
'categoryId' => '917329dfd5288b0011332300'
]),
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/actions/copy-category"
payload := strings.NewReader("{\n \"parentCollectionId\": \"64184766610c0e32a86d8758\",\n \"categoryId\": \"917329dfd5288b0011332300\"\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/collections/actions/copy-category")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"parentCollectionId\": \"64184766610c0e32a86d8758\",\n \"categoryId\": \"917329dfd5288b0011332300\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/collections/actions/copy-category")
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 \"parentCollectionId\": \"64184766610c0e32a86d8758\",\n \"categoryId\": \"917329dfd5288b0011332300\"\n}"
response = http.request(request)
puts response.read_body{
"id": "53184766610c0e32a86d875",
"name": "Color",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isRoot": true,
"isLeaf": false,
"categoryAttributes": [
{
"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"
}
],
"productAttributes": [
{
"id": "33184766610c0e32a86d8759",
"name": "Color",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isInherited": true,
"type": "TEXT",
"isMandatory": true
}
],
"productIds": [
"64184766610c0e32a86d8758"
],
"children": [
{
"id": "33184766610c0e32a86d8759",
"name": "Color",
"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": "PAYLOAD_LIMIT_EXCEEDED_ERROR",
"message": "The payload exceeds maximum configured size"
}{
"type": "SERVER_ERROR",
"message": "Internal Server Error"
}Copy Category to Collections
This endpoint is used to replicate category tree hierarchy to collections.
curl --request POST \
--url https://api.fabric.inc/v3/collections/actions/copy-category \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"parentCollectionId": "64184766610c0e32a86d8758",
"categoryId": "917329dfd5288b0011332300"
}
'import requests
url = "https://api.fabric.inc/v3/collections/actions/copy-category"
payload = {
"parentCollectionId": "64184766610c0e32a86d8758",
"categoryId": "917329dfd5288b0011332300"
}
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({
parentCollectionId: '64184766610c0e32a86d8758',
categoryId: '917329dfd5288b0011332300'
})
};
fetch('https://api.fabric.inc/v3/collections/actions/copy-category', 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/actions/copy-category",
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([
'parentCollectionId' => '64184766610c0e32a86d8758',
'categoryId' => '917329dfd5288b0011332300'
]),
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/actions/copy-category"
payload := strings.NewReader("{\n \"parentCollectionId\": \"64184766610c0e32a86d8758\",\n \"categoryId\": \"917329dfd5288b0011332300\"\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/collections/actions/copy-category")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"parentCollectionId\": \"64184766610c0e32a86d8758\",\n \"categoryId\": \"917329dfd5288b0011332300\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/collections/actions/copy-category")
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 \"parentCollectionId\": \"64184766610c0e32a86d8758\",\n \"categoryId\": \"917329dfd5288b0011332300\"\n}"
response = http.request(request)
puts response.read_body{
"id": "53184766610c0e32a86d875",
"name": "Color",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isRoot": true,
"isLeaf": false,
"categoryAttributes": [
{
"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"
}
],
"productAttributes": [
{
"id": "33184766610c0e32a86d8759",
"name": "Color",
"localizedProperties": {
"en-US": {
"name": "Color"
},
"en-IN": {
"name": "Colour"
}
},
"isLocalizable": true,
"isInherited": true,
"type": "TEXT",
"isMandatory": true
}
],
"productIds": [
"64184766610c0e32a86d8758"
],
"children": [
{
"id": "33184766610c0e32a86d8759",
"name": "Color",
"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": "PAYLOAD_LIMIT_EXCEEDED_ERROR",
"message": "The payload exceeds maximum configured size"
}{
"type": "SERVER_ERROR",
"message": "Internal 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"
Body
Request body for copy
Response
OK
Category details
24-character system-generated category ID
"53184766610c0e32a86d875"
Non-localized category name
"Color"
Localized properties of category
Show child attributes
Show child attributes
{
"en-US": { "name": "Color" },
"en-IN": { "name": "Colour" }
}
true: Category name is translated into different languages or localized for different regions
false: Category name isn't localized Note: Refer to localizedProperties to get relevant details based on locale
true
true: This is a root category
false: This isn't a root category
true
true: This is the last category of the branch with no further children categories
false: This isn't the last category of the branch and has children categories
false
Attributes assigned to the specified category
Show child attributes
Show child attributes
Attributes assigned for all products in the specified category.
Show child attributes
Show child attributes
System-generated 24-character product IDs associated with a category
Immediate children of the specified category
Show child attributes
Show child attributes
Email of user who last update the category
"test@eamil.com"
Time of last update to category
"2023-04-20T10:24:36.162Z"
Time of category creation
"2021-04-20T10:24:36.162Z"
Was this page helpful?
