curl --request GET \
--url https://api.messaging.phonovation.com/people/3/segments/{segmentId} \
--header 'Authorization: <api-key>'import requests
url = "https://api.messaging.phonovation.com/people/3/segments/{segmentId}"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)using RestSharp;
var options = new RestClientOptions("https://api.messaging.phonovation.com/people/3/segments/{segmentId}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.get("https://api.messaging.phonovation.com/people/3/segments/{segmentId}")
.header("Authorization", "<api-key>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.messaging.phonovation.com/people/3/segments/{segmentId}",
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: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.messaging.phonovation.com/people/3/segments/{segmentId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 42,
"name": "VIP Alex Clients",
"description": "Persons named Alex with tag \"VIP Client\"",
"query": {
"#and": [
{
"firstName": "Alex"
},
{
"#contains": {
"tags": "VIP Client"
}
}
]
},
"events": [
{
"definitionId": "addedToCart",
"timelineCondition": {
"occurred": "ALL",
"operator": "BETWEEN",
"start": 60,
"end": 30,
"units": "DAYS"
},
"occurrenceCondition": {
"operation": "IS",
"times": 5
},
"payloadConditions": [
{
"attribute": "itemId",
"operator": "EQ",
"value": "10001"
}
]
}
],
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}{
"errorCode": "E401",
"description": "The request lacks valid authentication credentials for the requested resource.",
"action": "Check the resources and adjust authentication credentials.",
"violations": [],
"resources": [
{
"name": "API Authentication",
"url": "https://www.phonovation.com/docs/essentials/api-authentication"
}
]
}{
"errorCode": "E403",
"description": "Insufficient permissions to access the requested resource.",
"action": "Repeat the request with new or different credentials.",
"violations": [],
"resources": [
{
"name": "API Scopes",
"url": "https://www.phonovation.com/docs/essentials/api-essentials/api-authorization#api-scopes"
}
]
}{
"errorCode": "E404",
"description": "Not found - request URL doesn't exist on the API server or resource is not found.",
"action": "Check the resources and adjust your request.",
"violations": [],
"resources": []
}{
"errorCode": "E429",
"description": "Too many requests sent.",
"action": "Check request rate limit specified in the API endpoint documentation resource.",
"violations": [],
"resources": [
{
"name": "Throttling handling errors",
"url": "https://www.phonovation.com/docs/essentials/integration-best-practices#throttling-handling-errors"
}
]
}{
"errorCode": "E500",
"description": "Something went wrong.",
"action": "Contact the support.",
"violations": [],
"resources": []
}Get a segment
Use this method to get a segment by ID.
Required scope: Enable one of: people:read, people:manage.
curl --request GET \
--url https://api.messaging.phonovation.com/people/3/segments/{segmentId} \
--header 'Authorization: <api-key>'import requests
url = "https://api.messaging.phonovation.com/people/3/segments/{segmentId}"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)using RestSharp;
var options = new RestClientOptions("https://api.messaging.phonovation.com/people/3/segments/{segmentId}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.get("https://api.messaging.phonovation.com/people/3/segments/{segmentId}")
.header("Authorization", "<api-key>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.messaging.phonovation.com/people/3/segments/{segmentId}",
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: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.messaging.phonovation.com/people/3/segments/{segmentId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 42,
"name": "VIP Alex Clients",
"description": "Persons named Alex with tag \"VIP Client\"",
"query": {
"#and": [
{
"firstName": "Alex"
},
{
"#contains": {
"tags": "VIP Client"
}
}
]
},
"events": [
{
"definitionId": "addedToCart",
"timelineCondition": {
"occurred": "ALL",
"operator": "BETWEEN",
"start": 60,
"end": 30,
"units": "DAYS"
},
"occurrenceCondition": {
"operation": "IS",
"times": 5
},
"payloadConditions": [
{
"attribute": "itemId",
"operator": "EQ",
"value": "10001"
}
]
}
],
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}{
"errorCode": "E401",
"description": "The request lacks valid authentication credentials for the requested resource.",
"action": "Check the resources and adjust authentication credentials.",
"violations": [],
"resources": [
{
"name": "API Authentication",
"url": "https://www.phonovation.com/docs/essentials/api-authentication"
}
]
}{
"errorCode": "E403",
"description": "Insufficient permissions to access the requested resource.",
"action": "Repeat the request with new or different credentials.",
"violations": [],
"resources": [
{
"name": "API Scopes",
"url": "https://www.phonovation.com/docs/essentials/api-essentials/api-authorization#api-scopes"
}
]
}{
"errorCode": "E404",
"description": "Not found - request URL doesn't exist on the API server or resource is not found.",
"action": "Check the resources and adjust your request.",
"violations": [],
"resources": []
}{
"errorCode": "E429",
"description": "Too many requests sent.",
"action": "Check request rate limit specified in the API endpoint documentation resource.",
"violations": [],
"resources": [
{
"name": "Throttling handling errors",
"url": "https://www.phonovation.com/docs/essentials/integration-best-practices#throttling-handling-errors"
}
]
}{
"errorCode": "E500",
"description": "Something went wrong.",
"action": "Contact the support.",
"violations": [],
"resources": []
}Authorizations
This is the most secure authorization type and the one with the most flexibility.
API keys can be generated by calling the dedicated API method. Furthermore, API keys can have a limited scope and cover only some API methods. Lastly, they can be revoked at any time. This range of possibilities makes API keys well suited for separating the API access rights across multiple applications or use cases. Finally, the loss of an API key is easily manageable.
You can manage your API keys from GUI, or programmatically with dedicated API.
API key Authorization header example:
Authorization: App 003026bbc133714df1834b8638bb496e-8f4b3d9a-e931-478d-a994-28a725159ab9
Path Parameters
A unique segment identifier.
42
Response
OK
A unique segment identifier.
42
A unique segment name.
"VIP Alex Clients"
Segment description.
"Persons named Alex with tag \"VIP Client\""
Allows to filter persons using simple queries.
Supported logical operators
| Operator | Description | Example |
|---|---|---|
#and | All records that match the conditions of all clauses. | {"#and":[{"firstName":"John"},{"lastName":"Smith"}]} |
#or | All records that match the conditions of any clause. | {"#or":[{"firstName":"John"},{"firstName":"Jane"}]} |
Supported comparison operators
| Attributes | Description | Example |
|---|---|---|
#notExist | Matches records that do not have given attribute. | {"#notExist":"firstName"} |
#exist | Matches records that have given attribute. | {"#exists":"firstName"} |
| Strings | Description | Example |
#eq | Equals to a specified string. | {"firstName":"John"} |
#ne | Not equal to a specified string. | {"#ne":{"firstName":"John"}} |
#startsWith | Starts with a specified string. | {"#startsWith":{"firstName":"John"}} |
#endsWith | Ends with a specified string. | {"#endsWith":{"firstName":"John"}} |
#contains | Contains a specified string. | {"#contains":{"firstName":"oh"}} |
#notContain | Does not contain a specified string. | {"#notContain":{"firstName":"oh"}} |
#in | At least one of the strings in a list. | {"#in":{"firstName":["John","Jane"]}} |
#notIn | Not any of the strings in a list. | {"#notIn":{"firstName":["John","Jane"]}} |
| Dates | Description | Example |
#eq | Equals to a specified date. | {"birthDate":"1987-07-10"} |
#ne | Not equal to a specified date. | {"#ne":{"birthDate":"1987-07-10"}} |
#eq (relative) | Will be in specified interval. | {"#eq":{"birthDate":{"#relNow":"P1D"}}} |
#lt (relative) | Will be within a specified interval. | {"#lt":{"birthDate":{"#relNow":"P1D"}}} |
#gt (relative) | Will be in more than a specified interval. | {"#gt":{"birthDate":{"#relNow":"P1D"}}} |
#eq (relative) - | Was a specified interval ago. | {"#eq":{"birthDate":{"#relNow":"P-1D"}}} |
#gt (relative) - | Was within a specified interval ago. | {"#gt":{"birthDate":{"#relNow":"P-1D"}}} |
#gt (relative) - | Was more than a specified interval ago. | {"#gt":{"birthDate":{"#relNow":"P-1D"}}} |
#lt | Is before a specified date. | {"#lt":{"birthDate":"1987-07-10"}} |
#lte | Is before or equal to a specified date. | {"#lte":{"birthDate":"1987-07-10"}} |
#gt | Is after a specified date. | {"#gt":{"birthDate":"1987-07-10"}} |
#gte | Is after or equal to a specified date. | {"#gte":{"birthDate":"1987-07-10"}} |
#in | Is equal to one of dates in a given list. | {"#in":{"birthDate":["1987-07-10","1987-07-11"]}} |
#notIn | Is not equal to any of dates in a given list. | {"#notIn":{"birthDate":["1987-07-10","1987-07-11"]}} |
| Integers | Description | Example |
#eq | Equals to a specified integer. | {"data\u0001counter":1} |
#ne | Not equal to a specified integer. | {"#ne":{"data\u0001counter":1}} |
#lt | Is less than a specified integer. | {"#lt":{"data\u0001counter":1}} |
#lte | Is less than or equal to a specified integer. | {"#lte":{"data\u0001counter":1}} |
#gt | Is greater than a specified integer. | {"#gt":{"data\u0001counter":1}} |
#gte | Is greater than or equal to a specified integer. | {"#gte":{"data\u0001counter":1}} |
#in | Is equal to any of specified integers in a list. | {"#in":{"data\u0001counter":[1,2,3]}} |
#notIn | Is not equal to any of specified integers in a list. | {"#notIn":{"data\u0001counter":[1,2,3]}} |
| Decimals | Description | Example |
#eq | Equals to a specified decimal. | {"data\u0001price":1.1} |
#ne | Is not equal to a specified decimal. | {"#ne":{"data\u0001price":1.1}} |
#lt | Is less than a specified decimal. | {"#lt":{"data\u0001price":1.1}} |
#lte | Is less than or equal to a specified decimal. | {"#lte":{"data\u0001price":1.1}} |
#gt | Is greater than a specified decimal. | {"#gt":{"data\u0001price":1.1}} |
#gte | Is greater than or equal to a specified decimal. | {"#gte":{"data\u0001price":1.1}} |
#in | Is equal to any of specified decimals in a list. | {"#in":{"data\u0001price":[1.1,2.1,3.0]}} |
#notIn | Is not equal to any of specified decimals in a list. | {"#notIn":{"data\u0001price":[1.1,2.1,3.0]}} |
| Booleans | Description | Example |
#eq | Equals to a specified boolean. | {"data\u0001happy":true} |
#ne | Not equal to a specified boolean. | {"#ne":{"data\u0001happy":true}} |
| Tags | Description | Example |
#contains | Contains a specified tag. | {"#contains":{"tags":"SOME_TAG"}} |
#notContain | Does not contain a specified tag. | {"#notContain":{"tags":"SOME_TAG"}} |
| Gender | Description | Example |
#eq | Equals a specified gender. | {"gender":"MALE"} |
#ne | Does not equal a specified gender. | {"#ne":{"gender":"FEMALE"}} |
| Lists | Description | Example |
#all | All items in the list match. | {"#all":{"data\u0001Cart":{"#and":[{"ProductName":"Laptop"},{"ProductPrice":2000}]}}}
|
#any | Any item in the list match. | {"#any":{"data\u0001Cart":{"#and":[{"ProductName":"Laptop"},{"ProductPrice":2000}]}}}
|
Show child attributes
Show child attributes
{
"#and": [
{ "firstName": "Alex" },
{ "#contains": { "tags": "VIP Client" } }
]
}
List of events that persons should match.
Show child attributes
Show child attributes
Date and time of creation. Has the following format: yyyy-MM-dd'T'HH:mm:ss.SSSZ.
Date and time of last modification. Has the following format: yyyy-MM-dd'T'HH:mm:ss.SSSZ.