Retrieve segments to which the guest is belonging to
curl --request GET \
--url https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/guests/{guest_id}/segments \
--header 'Authorization: Bearer <token>'const url = 'https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/guests/{guest_id}/segments';
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}/guests/{guest_id}/segments"
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}/guests/{guest_id}/segments",
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}/guests/{guest_id}/segments");
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}/guests/{guest_id}/segments")
.header("Authorization", "Bearer <token>")
.asString();[
{
"href": "/api/guestprofile/entities/22b9b15f-c229-491c-bc58-82d0c6a8fae2/segments/c51dcc28-5715-442e-a5a9-2e916c51683e",
"model": {
"id": "c51dcc28-5715-442e-a5a9-2e916c51683e",
"entityId": "22b9b15f-c229-491c-bc58-82d0c6a8fae2",
"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": ">"
}
]
}
]
}
}
}
]{
"code": "system.accessDenied",
"message": "system.accessDenied",
"data": {}
}{
"code": "system.notFound",
"message": "system.notFound",
"data": {}
}{
"code": "system.timeout",
"message": "system.timeout",
"data": {}
}{
"code": "system.internalError",
"message": "system.internalError",
"data": {}
}Segments
Get a guest's segments
List the segments whose criteria match a guest
GET
/
api
/
guestprofile
/
entities
/
{entity_id}
/
guests
/
{guest_id}
/
segments
Retrieve segments to which the guest is belonging to
curl --request GET \
--url https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/guests/{guest_id}/segments \
--header 'Authorization: Bearer <token>'const url = 'https://{apiBaseUrl}/api/guestprofile/entities/{entity_id}/guests/{guest_id}/segments';
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}/guests/{guest_id}/segments"
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}/guests/{guest_id}/segments",
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}/guests/{guest_id}/segments");
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}/guests/{guest_id}/segments")
.header("Authorization", "Bearer <token>")
.asString();[
{
"href": "/api/guestprofile/entities/22b9b15f-c229-491c-bc58-82d0c6a8fae2/segments/c51dcc28-5715-442e-a5a9-2e916c51683e",
"model": {
"id": "c51dcc28-5715-442e-a5a9-2e916c51683e",
"entityId": "22b9b15f-c229-491c-bc58-82d0c6a8fae2",
"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": ">"
}
]
}
]
}
}
}
]{
"code": "system.accessDenied",
"message": "system.accessDenied",
"data": {}
}{
"code": "system.notFound",
"message": "system.notFound",
"data": {}
}{
"code": "system.timeout",
"message": "system.timeout",
"data": {}
}{
"code": "system.internalError",
"message": "system.internalError",
"data": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Was this page helpful?