Upsert reference book
curl --request POST \
--url https://{host}/product-catalog/v1/HierarchyReferenceBook/Import \
--header 'Content-Type: application/json' \
--data '
[
{
"depthId": 0,
"name": "Root",
"externalDepth": -1
},
{
"depthId": 1,
"name": "Level 1",
"externalDepth": 1
},
{
"depthId": 2,
"name": "Level 2",
"externalDepth": 2
},
{
"depthId": 3,
"name": "Level 3",
"externalDepth": 3
},
{
"depthId": 4,
"name": "Level 4",
"externalDepth": 4
},
{
"depthId": 5,
"name": "Level 5",
"externalDepth": 5
}
]
'import requests
url = "https://{host}/product-catalog/v1/HierarchyReferenceBook/Import"
payload = [
{
"depthId": 0,
"name": "Root",
"externalDepth": -1
},
{
"depthId": 1,
"name": "Level 1",
"externalDepth": 1
},
{
"depthId": 2,
"name": "Level 2",
"externalDepth": 2
},
{
"depthId": 3,
"name": "Level 3",
"externalDepth": 3
},
{
"depthId": 4,
"name": "Level 4",
"externalDepth": 4
},
{
"depthId": 5,
"name": "Level 5",
"externalDepth": 5
}
]
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify([
{depthId: 0, name: 'Root', externalDepth: -1},
{depthId: 1, name: 'Level 1', externalDepth: 1},
{depthId: 2, name: 'Level 2', externalDepth: 2},
{depthId: 3, name: 'Level 3', externalDepth: 3},
{depthId: 4, name: 'Level 4', externalDepth: 4},
{depthId: 5, name: 'Level 5', externalDepth: 5}
])
};
fetch('https://{host}/product-catalog/v1/HierarchyReferenceBook/Import', 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://{host}/product-catalog/v1/HierarchyReferenceBook/Import",
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([
[
'depthId' => 0,
'name' => 'Root',
'externalDepth' => -1
],
[
'depthId' => 1,
'name' => 'Level 1',
'externalDepth' => 1
],
[
'depthId' => 2,
'name' => 'Level 2',
'externalDepth' => 2
],
[
'depthId' => 3,
'name' => 'Level 3',
'externalDepth' => 3
],
[
'depthId' => 4,
'name' => 'Level 4',
'externalDepth' => 4
],
[
'depthId' => 5,
'name' => 'Level 5',
'externalDepth' => 5
]
]),
CURLOPT_HTTPHEADER => [
"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://{host}/product-catalog/v1/HierarchyReferenceBook/Import"
payload := strings.NewReader("[\n {\n \"depthId\": 0,\n \"name\": \"Root\",\n \"externalDepth\": -1\n },\n {\n \"depthId\": 1,\n \"name\": \"Level 1\",\n \"externalDepth\": 1\n },\n {\n \"depthId\": 2,\n \"name\": \"Level 2\",\n \"externalDepth\": 2\n },\n {\n \"depthId\": 3,\n \"name\": \"Level 3\",\n \"externalDepth\": 3\n },\n {\n \"depthId\": 4,\n \"name\": \"Level 4\",\n \"externalDepth\": 4\n },\n {\n \"depthId\": 5,\n \"name\": \"Level 5\",\n \"externalDepth\": 5\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
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://{host}/product-catalog/v1/HierarchyReferenceBook/Import")
.header("Content-Type", "application/json")
.body("[\n {\n \"depthId\": 0,\n \"name\": \"Root\",\n \"externalDepth\": -1\n },\n {\n \"depthId\": 1,\n \"name\": \"Level 1\",\n \"externalDepth\": 1\n },\n {\n \"depthId\": 2,\n \"name\": \"Level 2\",\n \"externalDepth\": 2\n },\n {\n \"depthId\": 3,\n \"name\": \"Level 3\",\n \"externalDepth\": 3\n },\n {\n \"depthId\": 4,\n \"name\": \"Level 4\",\n \"externalDepth\": 4\n },\n {\n \"depthId\": 5,\n \"name\": \"Level 5\",\n \"externalDepth\": 5\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/product-catalog/v1/HierarchyReferenceBook/Import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"depthId\": 0,\n \"name\": \"Root\",\n \"externalDepth\": -1\n },\n {\n \"depthId\": 1,\n \"name\": \"Level 1\",\n \"externalDepth\": 1\n },\n {\n \"depthId\": 2,\n \"name\": \"Level 2\",\n \"externalDepth\": 2\n },\n {\n \"depthId\": 3,\n \"name\": \"Level 3\",\n \"externalDepth\": 3\n },\n {\n \"depthId\": 4,\n \"name\": \"Level 4\",\n \"externalDepth\": 4\n },\n {\n \"depthId\": 5,\n \"name\": \"Level 5\",\n \"externalDepth\": 5\n }\n]"
response = http.request(request)
puts response.read_body{}{
"errors": [
{
"name": "<string>",
"message": "<string>",
"details": null
}
]
}Upsert reference book
Imports hierarchy reference book (upserts existing levels and adds new levels). Usually performed via direct integration with Data Import service.
POST
/
v1
/
HierarchyReferenceBook
/
Import
Upsert reference book
curl --request POST \
--url https://{host}/product-catalog/v1/HierarchyReferenceBook/Import \
--header 'Content-Type: application/json' \
--data '
[
{
"depthId": 0,
"name": "Root",
"externalDepth": -1
},
{
"depthId": 1,
"name": "Level 1",
"externalDepth": 1
},
{
"depthId": 2,
"name": "Level 2",
"externalDepth": 2
},
{
"depthId": 3,
"name": "Level 3",
"externalDepth": 3
},
{
"depthId": 4,
"name": "Level 4",
"externalDepth": 4
},
{
"depthId": 5,
"name": "Level 5",
"externalDepth": 5
}
]
'import requests
url = "https://{host}/product-catalog/v1/HierarchyReferenceBook/Import"
payload = [
{
"depthId": 0,
"name": "Root",
"externalDepth": -1
},
{
"depthId": 1,
"name": "Level 1",
"externalDepth": 1
},
{
"depthId": 2,
"name": "Level 2",
"externalDepth": 2
},
{
"depthId": 3,
"name": "Level 3",
"externalDepth": 3
},
{
"depthId": 4,
"name": "Level 4",
"externalDepth": 4
},
{
"depthId": 5,
"name": "Level 5",
"externalDepth": 5
}
]
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify([
{depthId: 0, name: 'Root', externalDepth: -1},
{depthId: 1, name: 'Level 1', externalDepth: 1},
{depthId: 2, name: 'Level 2', externalDepth: 2},
{depthId: 3, name: 'Level 3', externalDepth: 3},
{depthId: 4, name: 'Level 4', externalDepth: 4},
{depthId: 5, name: 'Level 5', externalDepth: 5}
])
};
fetch('https://{host}/product-catalog/v1/HierarchyReferenceBook/Import', 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://{host}/product-catalog/v1/HierarchyReferenceBook/Import",
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([
[
'depthId' => 0,
'name' => 'Root',
'externalDepth' => -1
],
[
'depthId' => 1,
'name' => 'Level 1',
'externalDepth' => 1
],
[
'depthId' => 2,
'name' => 'Level 2',
'externalDepth' => 2
],
[
'depthId' => 3,
'name' => 'Level 3',
'externalDepth' => 3
],
[
'depthId' => 4,
'name' => 'Level 4',
'externalDepth' => 4
],
[
'depthId' => 5,
'name' => 'Level 5',
'externalDepth' => 5
]
]),
CURLOPT_HTTPHEADER => [
"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://{host}/product-catalog/v1/HierarchyReferenceBook/Import"
payload := strings.NewReader("[\n {\n \"depthId\": 0,\n \"name\": \"Root\",\n \"externalDepth\": -1\n },\n {\n \"depthId\": 1,\n \"name\": \"Level 1\",\n \"externalDepth\": 1\n },\n {\n \"depthId\": 2,\n \"name\": \"Level 2\",\n \"externalDepth\": 2\n },\n {\n \"depthId\": 3,\n \"name\": \"Level 3\",\n \"externalDepth\": 3\n },\n {\n \"depthId\": 4,\n \"name\": \"Level 4\",\n \"externalDepth\": 4\n },\n {\n \"depthId\": 5,\n \"name\": \"Level 5\",\n \"externalDepth\": 5\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
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://{host}/product-catalog/v1/HierarchyReferenceBook/Import")
.header("Content-Type", "application/json")
.body("[\n {\n \"depthId\": 0,\n \"name\": \"Root\",\n \"externalDepth\": -1\n },\n {\n \"depthId\": 1,\n \"name\": \"Level 1\",\n \"externalDepth\": 1\n },\n {\n \"depthId\": 2,\n \"name\": \"Level 2\",\n \"externalDepth\": 2\n },\n {\n \"depthId\": 3,\n \"name\": \"Level 3\",\n \"externalDepth\": 3\n },\n {\n \"depthId\": 4,\n \"name\": \"Level 4\",\n \"externalDepth\": 4\n },\n {\n \"depthId\": 5,\n \"name\": \"Level 5\",\n \"externalDepth\": 5\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/product-catalog/v1/HierarchyReferenceBook/Import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"depthId\": 0,\n \"name\": \"Root\",\n \"externalDepth\": -1\n },\n {\n \"depthId\": 1,\n \"name\": \"Level 1\",\n \"externalDepth\": 1\n },\n {\n \"depthId\": 2,\n \"name\": \"Level 2\",\n \"externalDepth\": 2\n },\n {\n \"depthId\": 3,\n \"name\": \"Level 3\",\n \"externalDepth\": 3\n },\n {\n \"depthId\": 4,\n \"name\": \"Level 4\",\n \"externalDepth\": 4\n },\n {\n \"depthId\": 5,\n \"name\": \"Level 5\",\n \"externalDepth\": 5\n }\n]"
response = http.request(request)
puts response.read_body{}{
"errors": [
{
"name": "<string>",
"message": "<string>",
"details": null
}
]
}Last modified on August 10, 2026
⌘I