Retrieves All Menu Items - Fabric
Retrieves All Menu Items
cURL
curl --request GET \
--url https://cdn.xm.fabric.inc/api/menu/items \
--header 'x-site-context: <x-site-context>'
import requests
url = "https://cdn.xm.fabric.inc/api/menu/items"
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/items', 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/items",
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/items"
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/items")
.header("x-site-context", "<x-site-context>")
.asString();
require 'uri'
require 'net/http'
url = URI("https://cdn.xm.fabric.inc/api/menu/items")
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
Possible Responses
200
{
"status_code": 200,
"status": "List of active menus",
"data": {
"MenuList": [
{
"id": "61110b8d3e136500082f5d42",
"label": "Gifts + Holiday",
"order": 1,
"isActive": true,
"channel": [
12
],
"path": "/c/gifts",
"params": [
{
"_id": "61110bba873a390008d3a2fe",
"kind": "context",
"value": "gifts"
}
],
"children": [
{
"id": "61110bcb3e136500082f5d48",
"label": "Gifts by Price",
"order": 1,
"isActive": true,
"channel": [
12
],
"path": "/c/gifts/gifts-by-price",
"params": [
{
"_id": "61110bdd873a390008d3a303",
"kind": "context",
"value": "gifts_gifts-by-price"
}
],
"children": [
{
"id": "61110bf93e136500082f5d4d",
"label": "Gifts Under $250",
"order": 1,
"isActive": true,
"channel": [
12
],
"path": "/c/gifts/gifts-by-price/gifts-under-250",
"params": [
{
"kind": "context",
"value": "gifts_gifts-by-price_gifts-under-250"
}
],
"children": []
},
{
"id": "61110c1a3e136500082f5d52",
"label": "Gifts Under $500",
"order": 2,
"isActive": false,
"channel": [
12
],
"path": "/c/gifts/gifts-by-price/gifts-under-500",
"params": [
{
"kind": "context",
"value": "gifts_gifts-by-price_gifts-under-500"
}
],
"children": []
}
]
},
{
"id": "61110c3e3e136500082f5d56",
"label": "Dining + Entertainment",
"order": 3,
"isActive": true,
"channel": [
12
],
"path": "/",
"params": [],
"children": [
{
"id": "61110c513e136500082f5d5b",
"label": "All Dining + Entertainment",
"order": 1,
"isActive": true,
"channel": [
12
],
"path": "/content/shop/dining-entertaining",
"params": [
{
"kind": "",
"value": ""
}
],
"children": []
}
]
}
]
}
]
}
}
404
{
"code": "MENU_NOT_FOUND",
"message": "No menu entry found."
}
500
{
"code": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}
Headers
- x-site-context : string (required)
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"}