Retrieves Live Global Components - Fabric

Retrieves Live Global Components

cURL

curl --request GET \
  --url https://cdn.xm.fabric.inc/api/global-component/live \
  --header 'x-site-context: <x-site-context>'
import requests

url = "https://cdn.xm.fabric.inc/api/global-component/live"

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/global-component/live', 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/global-component/live",\
  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/global-component/live"

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/global-component/live")
  .header("x-site-context", "<x-site-context>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://cdn.xm.fabric.inc/api/global-component/live")

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

Response

Status: 200

LiveComponents

[
  {
    "_id": "60896f629aa7f1000744030b",
    "id": "RailNavigation",
    "params": {
      "homeLinkText": "Home",
      "sections": [
        {
          "sectionTitle": "Get Started",
          "sectionLink": "/start",
          "subsections": [
            {
              "subSectionTitle": "What is fabric?",
              "subSectionLink": "/what-is-fabric",
              "components": []
            }
          ],
          "components": []
        }
      ],
      "title": "Title"
    },
    "order": 1
  },
  {
    "_id": "608ad8760536ac00074bec45",
    "id": "CustomHeader",
    "params": {
      "developerSectionText": "developerSectionText",
      "developerSectionLinks": [
        {
          "title": "Knowledge Base",
          "description": "Get started",
          "link": "https://fabric.inc/knowledgebase",
          "components": []
        },
        {
          "title": "API documentation",
          "description": "Customize without limits",
          "link": "https://api.fabric.inc/",
          "components": []
        }
      ]
    },
    "order": 1
  }
]

Headers

Example: json "{\"date\": \"2023-01-01T00:00:00.000Z\", \"channel\": 12, \"account\": \"1234abcd5678efgh9ijklmno\",\"stage\":\"production\"}"

Response Structure