Get Live Page For A Channel By URL
curl --request GET \
--url https://cdn.xm.fabric.inc/api/v2/page/live \
--header 'x-site-context: <x-site-context>'import requests
url = "https://cdn.xm.fabric.inc/api/v2/page/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/v2/page/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/v2/page/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/v2/page/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/v2/page/live")
.header("x-site-context", "<x-site-context>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cdn.xm.fabric.inc/api/v2/page/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{
"status_code": 200,
"message": "Live version: 2446 for page: /components",
"data": {
"page": {
"_id": "613a76a15363f9e9575dc953",
"name": "Components",
"pageUrl": "/components",
"__v": 0,
"channels": [
"00SZAU",
"02SZCA"
],
"createdAt": "2021-09-09T21:03:29.617Z",
"isActive": true,
"isArchived": false,
"pageId": 1377,
"seoFields": {
"title": "SEO",
"description": "SEO description",
"_id": "612e4756c4b3c60010fff859",
"metadata": [
{
"_id": "612e4756c4b3c60010fff85a",
"name": "summary",
"content": "Types of components",
"createdAt": "2021-08-31T15:14:30.973Z",
"updatedAt": "2021-08-31T15:14:30.973Z"
}
],
"createdAt": "2021-08-31T15:14:30.973Z",
"updatedAt": "2021-08-31T15:14:30.973Z"
},
"updatedAt": "2021-10-14T20:31:46.794Z",
"pageType": {
"isDefault": false,
"name": "Product category page",
"urlPrefix": "/category"
}
},
"version": [
{
"_id": "613a76a1fa9449000f6c36c3",
"isArchived": false,
"name": "Default",
"channel": [
12
],
"channels": [
"00SZAU",
"02SZCA"
],
"createdAt": "2021-09-09T21:03:29.712Z",
"updatedAt": "2021-10-14T20:31:47.369Z",
"components": {
"_id": "61689237068cae000f12ef90",
"id": "AboutUs",
"params": {
"desktopHeroImage": {
"url": "https://imgurl.com/path/myPhoto.jpg",
"altText": "Custom image"
},
"aboutUsContent": [
{
"text": "About us",
"firstText": "Our Company",
"secondText": "Our mission",
"thirdText": "Our values",
"paragraph": false,
"dialog": false,
"components": []
}
],
"components": [],
"additionalProp1": {}
},
"order": 1,
"additionalProp1": {}
},
"endDate": "2099-12-31T00:00:00.000Z",
"pageId": "613a76a15363f9e9575dc953",
"status": "SCHEDULED",
"versionId": 2446,
"__v": 0,
"startDate": "2021-10-14T20:31:44.052Z"
}
]
}
}
Pages
Get Live Page For A Channel By URL
Gets live page for the specified page URL and channel
GET
/
v2
/
page
/
live
Get Live Page For A Channel By URL
curl --request GET \
--url https://cdn.xm.fabric.inc/api/v2/page/live \
--header 'x-site-context: <x-site-context>'import requests
url = "https://cdn.xm.fabric.inc/api/v2/page/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/v2/page/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/v2/page/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/v2/page/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/v2/page/live")
.header("x-site-context", "<x-site-context>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cdn.xm.fabric.inc/api/v2/page/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{
"status_code": 200,
"message": "Live version: 2446 for page: /components",
"data": {
"page": {
"_id": "613a76a15363f9e9575dc953",
"name": "Components",
"pageUrl": "/components",
"__v": 0,
"channels": [
"00SZAU",
"02SZCA"
],
"createdAt": "2021-09-09T21:03:29.617Z",
"isActive": true,
"isArchived": false,
"pageId": 1377,
"seoFields": {
"title": "SEO",
"description": "SEO description",
"_id": "612e4756c4b3c60010fff859",
"metadata": [
{
"_id": "612e4756c4b3c60010fff85a",
"name": "summary",
"content": "Types of components",
"createdAt": "2021-08-31T15:14:30.973Z",
"updatedAt": "2021-08-31T15:14:30.973Z"
}
],
"createdAt": "2021-08-31T15:14:30.973Z",
"updatedAt": "2021-08-31T15:14:30.973Z"
},
"updatedAt": "2021-10-14T20:31:46.794Z",
"pageType": {
"isDefault": false,
"name": "Product category page",
"urlPrefix": "/category"
}
},
"version": [
{
"_id": "613a76a1fa9449000f6c36c3",
"isArchived": false,
"name": "Default",
"channel": [
12
],
"channels": [
"00SZAU",
"02SZCA"
],
"createdAt": "2021-09-09T21:03:29.712Z",
"updatedAt": "2021-10-14T20:31:47.369Z",
"components": {
"_id": "61689237068cae000f12ef90",
"id": "AboutUs",
"params": {
"desktopHeroImage": {
"url": "https://imgurl.com/path/myPhoto.jpg",
"altText": "Custom image"
},
"aboutUsContent": [
{
"text": "About us",
"firstText": "Our Company",
"secondText": "Our mission",
"thirdText": "Our values",
"paragraph": false,
"dialog": false,
"components": []
}
],
"components": [],
"additionalProp1": {}
},
"order": 1,
"additionalProp1": {}
},
"endDate": "2099-12-31T00:00:00.000Z",
"pageId": "613a76a15363f9e9575dc953",
"status": "SCHEDULED",
"versionId": 2446,
"__v": 0,
"startDate": "2021-10-14T20:31:44.052Z"
}
]
}
}
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\"}"
Query Parameters
Relative page url for which to retrieve the live page version
Comma-separated list of channel IDs
Was this page helpful?
⌘I
