Read segment definition
curl --request GET \
--url https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id} \
--header 'Authorization: Bearer <token>'const url = 'https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));import requests
url = "https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}using RestSharp;
var options = new RestClientOptions("https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.get("https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}")
.header("Authorization", "Bearer <token>")
.asString();{
"id": "b85ef2ca-d42e-4586-8a27-2fb441b7fee8",
"entityId": "073f0c9c-6b85-42f3-bd09-5858097b5f77",
"name": "Leisure/Family",
"type": "standard",
"createdAt": "2023-01-18T07:48:29+00:00",
"updatedAt": "2023-02-11T12:22:00+00:00",
"query": {
"logic": "AND",
"criteria": [
{
"logic": "OR",
"criteria": [
{
"field": "paxbabies",
"value": "0",
"operator": ">"
},
{
"field": "paxchildren",
"value": "0",
"operator": ">"
}
]
},
{
"logic": "AND",
"criteria": [
{
"field": "staylength",
"value": "2",
"operator": ">"
}
]
}
]
}
}Segments
Get a segment
Read the name and criteria of a segment
GET
/
api
/
guestprofile
/
entities
/
{entity_id}
/
segments
/
{segment_id}
Read segment definition
curl --request GET \
--url https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id} \
--header 'Authorization: Bearer <token>'const url = 'https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));import requests
url = "https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}using RestSharp;
var options = new RestClientOptions("https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.get("https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/segments/{segment_id}")
.header("Authorization", "Bearer <token>")
.asString();{
"id": "b85ef2ca-d42e-4586-8a27-2fb441b7fee8",
"entityId": "073f0c9c-6b85-42f3-bd09-5858097b5f77",
"name": "Leisure/Family",
"type": "standard",
"createdAt": "2023-01-18T07:48:29+00:00",
"updatedAt": "2023-02-11T12:22:00+00:00",
"query": {
"logic": "AND",
"criteria": [
{
"logic": "OR",
"criteria": [
{
"field": "paxbabies",
"value": "0",
"operator": ">"
},
{
"field": "paxchildren",
"value": "0",
"operator": ">"
}
]
},
{
"logic": "AND",
"criteria": [
{
"field": "staylength",
"value": "2",
"operator": ">"
}
]
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Was this page helpful?