Retrieves Menu List
curl --request GET \
--url https://cdn.xm.fabric.inc/api/menu \
--header 'x-site-context: <x-site-context>'import requests
url = "https://cdn.xm.fabric.inc/api/menu"
headers = {"x-site-context": "<x-site-context>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-site-context': '<x-site-context>'}};
fetch('https://cdn.xm.fabric.inc/api/menu', 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://cdn.xm.fabric.inc/api/menu",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-site-context: <x-site-context>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://cdn.xm.fabric.inc/api/menu"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-site-context", "<x-site-context>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://cdn.xm.fabric.inc/api/menu")
.header("x-site-context", "<x-site-context>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cdn.xm.fabric.inc/api/menu")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-site-context"] = '<x-site-context>'
response = http.request(request)
puts response.read_body{
"status_code": 200,
"status": "List of menus",
"data": {
"menus": [
{
"_id": "61110b8d3e136500082f5d42",
"channel": [
12
],
"channels": [],
"name": "Gifts + Holiday",
"label": "Gifts + Holiday",
"path": "/c/gifts",
"isActive": true,
"images": [],
"videos": [],
"params": [
{
"_id": "61110bba873a390008d3a2fe",
"kind": "context",
"value": "gifts"
}
],
"order": 1,
"createdAt": "2021-08-09T11:03:41.984Z",
"updatedAt": "2021-10-05T17:28:39.582Z",
"__v": 0,
"children": [
{
"_id": "61110bcb3e136500082f5d48",
"channel": [
12
],
"channels": [],
"name": "Gifts by Price",
"label": "Gifts by Price",
"parent": "61110b8d3e136500082f5d42",
"path": "/c/gifts/gifts-by-price",
"isActive": true,
"images": [],
"videos": [],
"params": [
{
"_id": "61110bdd873a390008d3a303",
"kind": "context",
"value": "gifts_gifts-by-price"
}
],
"order": 1,
"createdAt": "2021-08-09T11:04:43.526Z",
"updatedAt": "2021-08-09T11:11:57.833Z",
"__v": 0
}
]
},
{
"_id": "61138c153f658a00085e2eba",
"channel": [
12
],
"channels": [],
"name": "Bedroom",
"label": "Bedroom",
"path": "/",
"isActive": false,
"images": [],
"videos": [],
"params": [],
"order": 2,
"createdAt": "2021-08-11T08:36:37.823Z",
"updatedAt": "2021-10-05T17:28:39.650Z",
"__v": 0,
"children": []
}
]
}
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}Menu
Retrieves Menu List
Returns a list of all the menus and its immediate sub-menus
GET
/
menu
Retrieves Menu List
curl --request GET \
--url https://cdn.xm.fabric.inc/api/menu \
--header 'x-site-context: <x-site-context>'import requests
url = "https://cdn.xm.fabric.inc/api/menu"
headers = {"x-site-context": "<x-site-context>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-site-context': '<x-site-context>'}};
fetch('https://cdn.xm.fabric.inc/api/menu', 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://cdn.xm.fabric.inc/api/menu",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-site-context: <x-site-context>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://cdn.xm.fabric.inc/api/menu"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-site-context", "<x-site-context>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://cdn.xm.fabric.inc/api/menu")
.header("x-site-context", "<x-site-context>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cdn.xm.fabric.inc/api/menu")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-site-context"] = '<x-site-context>'
response = http.request(request)
puts response.read_body{
"status_code": 200,
"status": "List of menus",
"data": {
"menus": [
{
"_id": "61110b8d3e136500082f5d42",
"channel": [
12
],
"channels": [],
"name": "Gifts + Holiday",
"label": "Gifts + Holiday",
"path": "/c/gifts",
"isActive": true,
"images": [],
"videos": [],
"params": [
{
"_id": "61110bba873a390008d3a2fe",
"kind": "context",
"value": "gifts"
}
],
"order": 1,
"createdAt": "2021-08-09T11:03:41.984Z",
"updatedAt": "2021-10-05T17:28:39.582Z",
"__v": 0,
"children": [
{
"_id": "61110bcb3e136500082f5d48",
"channel": [
12
],
"channels": [],
"name": "Gifts by Price",
"label": "Gifts by Price",
"parent": "61110b8d3e136500082f5d42",
"path": "/c/gifts/gifts-by-price",
"isActive": true,
"images": [],
"videos": [],
"params": [
{
"_id": "61110bdd873a390008d3a303",
"kind": "context",
"value": "gifts_gifts-by-price"
}
],
"order": 1,
"createdAt": "2021-08-09T11:04:43.526Z",
"updatedAt": "2021-08-09T11:11:57.833Z",
"__v": 0
}
]
},
{
"_id": "61138c153f658a00085e2eba",
"channel": [
12
],
"channels": [],
"name": "Bedroom",
"label": "Bedroom",
"path": "/",
"isActive": false,
"images": [],
"videos": [],
"params": [],
"order": 2,
"createdAt": "2021-08-11T08:36:37.823Z",
"updatedAt": "2021-10-05T17:28:39.650Z",
"__v": 0,
"children": []
}
]
}
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}Headers
The x-site-context header is a JSON object that contains information about the source you wish to pull from. The mandatory account is the 24 character identifier found in Copilot. The channel (Sales channel ID), stage (environment name), and date attributes can be used to further narrow the scope of your data source.
Example:
"{\"date\": \"2023-01-01T00:00:00.000Z\", \"channel\": 12, \"account\": \"1234abcd5678efgh9ijklmno\",\"stage\":\"production\"}"
Was this page helpful?
⌘I
