cURL
curl --request POST \
--url https://api.comm.com/api/v1/segments/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": {
"condition": "AND",
"rules": [
{
"field": "clicked_count",
"operator": "greater",
"value": 0
},
{
"field": "country_id",
"operator": "equal",
"value": 225
},
{
"condition": "OR",
"rules": [
{
"field": "leads_count",
"operator": "equal",
"value": 1
},
{
"field": "sales_count",
"operator": "equal",
"value": 1
}
]
},
{
"field": "date_created",
"operator": "equal",
"value": "2023-07-05"
}
]
},
"page": 2,
"per_page": 50
}
'import requests
url = "https://api.comm.com/api/v1/segments/preview"
payload = {
"query": {
"condition": "AND",
"rules": [
{
"field": "clicked_count",
"operator": "greater",
"value": 0
},
{
"field": "country_id",
"operator": "equal",
"value": 225
},
{
"condition": "OR",
"rules": [
{
"field": "leads_count",
"operator": "equal",
"value": 1
},
{
"field": "sales_count",
"operator": "equal",
"value": 1
}
]
},
{
"field": "date_created",
"operator": "equal",
"value": "2023-07-05"
}
]
},
"page": 2,
"per_page": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: {
condition: 'AND',
rules: [
{field: 'clicked_count', operator: 'greater', value: 0},
{field: 'country_id', operator: 'equal', value: 225},
{
condition: 'OR',
rules: [
{field: 'leads_count', operator: 'equal', value: 1},
{field: 'sales_count', operator: 'equal', value: 1}
]
},
{field: 'date_created', operator: 'equal', value: '2023-07-05'}
]
},
page: 2,
per_page: 50
})
};
fetch('https://api.comm.com/api/v1/segments/preview', 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://api.comm.com/api/v1/segments/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => [
'condition' => 'AND',
'rules' => [
[
'field' => 'clicked_count',
'operator' => 'greater',
'value' => 0
],
[
'field' => 'country_id',
'operator' => 'equal',
'value' => 225
],
[
'condition' => 'OR',
'rules' => [
[
'field' => 'leads_count',
'operator' => 'equal',
'value' => 1
],
[
'field' => 'sales_count',
'operator' => 'equal',
'value' => 1
]
]
],
[
'field' => 'date_created',
'operator' => 'equal',
'value' => '2023-07-05'
]
]
],
'page' => 2,
'per_page' => 50
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.comm.com/api/v1/segments/preview"
payload := strings.NewReader("{\n \"query\": {\n \"condition\": \"AND\",\n \"rules\": [\n {\n \"field\": \"clicked_count\",\n \"operator\": \"greater\",\n \"value\": 0\n },\n {\n \"field\": \"country_id\",\n \"operator\": \"equal\",\n \"value\": 225\n },\n {\n \"condition\": \"OR\",\n \"rules\": [\n {\n \"field\": \"leads_count\",\n \"operator\": \"equal\",\n \"value\": 1\n },\n {\n \"field\": \"sales_count\",\n \"operator\": \"equal\",\n \"value\": 1\n }\n ]\n },\n {\n \"field\": \"date_created\",\n \"operator\": \"equal\",\n \"value\": \"2023-07-05\"\n }\n ]\n },\n \"page\": 2,\n \"per_page\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.comm.com/api/v1/segments/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": {\n \"condition\": \"AND\",\n \"rules\": [\n {\n \"field\": \"clicked_count\",\n \"operator\": \"greater\",\n \"value\": 0\n },\n {\n \"field\": \"country_id\",\n \"operator\": \"equal\",\n \"value\": 225\n },\n {\n \"condition\": \"OR\",\n \"rules\": [\n {\n \"field\": \"leads_count\",\n \"operator\": \"equal\",\n \"value\": 1\n },\n {\n \"field\": \"sales_count\",\n \"operator\": \"equal\",\n \"value\": 1\n }\n ]\n },\n {\n \"field\": \"date_created\",\n \"operator\": \"equal\",\n \"value\": \"2023-07-05\"\n }\n ]\n },\n \"page\": 2,\n \"per_page\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.comm.com/api/v1/segments/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": {\n \"condition\": \"AND\",\n \"rules\": [\n {\n \"field\": \"clicked_count\",\n \"operator\": \"greater\",\n \"value\": 0\n },\n {\n \"field\": \"country_id\",\n \"operator\": \"equal\",\n \"value\": 225\n },\n {\n \"condition\": \"OR\",\n \"rules\": [\n {\n \"field\": \"leads_count\",\n \"operator\": \"equal\",\n \"value\": 1\n },\n {\n \"field\": \"sales_count\",\n \"operator\": \"equal\",\n \"value\": 1\n }\n ]\n },\n {\n \"field\": \"date_created\",\n \"operator\": \"equal\",\n \"value\": \"2023-07-05\"\n }\n ]\n },\n \"page\": 2,\n \"per_page\": 50\n}"
response = http.request(request)
puts response.read_body{
"total": 123,
"rows": [
{
"team_id": "<string>",
"phone_normalized": "<string>",
"contact_id": "<string>",
"foreign_id": "<string>",
"last_sent": "<string>",
"last_clicked": "<string>",
"sent_count": 123,
"clicked_count": 123,
"leads_count": 123,
"sales_count": 123,
"network_brand": "<string>",
"network_id": "<string>",
"network_reason": "<string>",
"phone_is_good": "<string>",
"phone_is_good_reason": "<string>",
"name": "<string>",
"country_id": "<string>",
"state_id": "<string>",
"state_id_reason": "<string>",
"custom1_str": "<string>",
"custom2_str": "<string>",
"custom3_str": "<string>",
"custom4_str": "<string>",
"custom5_str": "<string>",
"custom1_int": "<string>",
"custom2_int": "<string>",
"custom3_int": "<string>",
"custom4_int": "<string>",
"custom5_int": "<string>",
"custom1_dec": "<string>",
"custom2_dec": "<string>",
"custom1_datetime": "<string>",
"custom2_datetime": "<string>",
"custom3_datetime": "<string>",
"custom4_datetime": "<string>",
"custom5_datetime": "<string>",
"meta": "<string>",
"date_created": "<string>",
"date_updated": "<string>"
}
],
"stats": {},
"sql": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Segments
Post v1segmentspreview
POST
/
v1
/
segments
/
preview
cURL
curl --request POST \
--url https://api.comm.com/api/v1/segments/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": {
"condition": "AND",
"rules": [
{
"field": "clicked_count",
"operator": "greater",
"value": 0
},
{
"field": "country_id",
"operator": "equal",
"value": 225
},
{
"condition": "OR",
"rules": [
{
"field": "leads_count",
"operator": "equal",
"value": 1
},
{
"field": "sales_count",
"operator": "equal",
"value": 1
}
]
},
{
"field": "date_created",
"operator": "equal",
"value": "2023-07-05"
}
]
},
"page": 2,
"per_page": 50
}
'import requests
url = "https://api.comm.com/api/v1/segments/preview"
payload = {
"query": {
"condition": "AND",
"rules": [
{
"field": "clicked_count",
"operator": "greater",
"value": 0
},
{
"field": "country_id",
"operator": "equal",
"value": 225
},
{
"condition": "OR",
"rules": [
{
"field": "leads_count",
"operator": "equal",
"value": 1
},
{
"field": "sales_count",
"operator": "equal",
"value": 1
}
]
},
{
"field": "date_created",
"operator": "equal",
"value": "2023-07-05"
}
]
},
"page": 2,
"per_page": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: {
condition: 'AND',
rules: [
{field: 'clicked_count', operator: 'greater', value: 0},
{field: 'country_id', operator: 'equal', value: 225},
{
condition: 'OR',
rules: [
{field: 'leads_count', operator: 'equal', value: 1},
{field: 'sales_count', operator: 'equal', value: 1}
]
},
{field: 'date_created', operator: 'equal', value: '2023-07-05'}
]
},
page: 2,
per_page: 50
})
};
fetch('https://api.comm.com/api/v1/segments/preview', 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://api.comm.com/api/v1/segments/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => [
'condition' => 'AND',
'rules' => [
[
'field' => 'clicked_count',
'operator' => 'greater',
'value' => 0
],
[
'field' => 'country_id',
'operator' => 'equal',
'value' => 225
],
[
'condition' => 'OR',
'rules' => [
[
'field' => 'leads_count',
'operator' => 'equal',
'value' => 1
],
[
'field' => 'sales_count',
'operator' => 'equal',
'value' => 1
]
]
],
[
'field' => 'date_created',
'operator' => 'equal',
'value' => '2023-07-05'
]
]
],
'page' => 2,
'per_page' => 50
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.comm.com/api/v1/segments/preview"
payload := strings.NewReader("{\n \"query\": {\n \"condition\": \"AND\",\n \"rules\": [\n {\n \"field\": \"clicked_count\",\n \"operator\": \"greater\",\n \"value\": 0\n },\n {\n \"field\": \"country_id\",\n \"operator\": \"equal\",\n \"value\": 225\n },\n {\n \"condition\": \"OR\",\n \"rules\": [\n {\n \"field\": \"leads_count\",\n \"operator\": \"equal\",\n \"value\": 1\n },\n {\n \"field\": \"sales_count\",\n \"operator\": \"equal\",\n \"value\": 1\n }\n ]\n },\n {\n \"field\": \"date_created\",\n \"operator\": \"equal\",\n \"value\": \"2023-07-05\"\n }\n ]\n },\n \"page\": 2,\n \"per_page\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.comm.com/api/v1/segments/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": {\n \"condition\": \"AND\",\n \"rules\": [\n {\n \"field\": \"clicked_count\",\n \"operator\": \"greater\",\n \"value\": 0\n },\n {\n \"field\": \"country_id\",\n \"operator\": \"equal\",\n \"value\": 225\n },\n {\n \"condition\": \"OR\",\n \"rules\": [\n {\n \"field\": \"leads_count\",\n \"operator\": \"equal\",\n \"value\": 1\n },\n {\n \"field\": \"sales_count\",\n \"operator\": \"equal\",\n \"value\": 1\n }\n ]\n },\n {\n \"field\": \"date_created\",\n \"operator\": \"equal\",\n \"value\": \"2023-07-05\"\n }\n ]\n },\n \"page\": 2,\n \"per_page\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.comm.com/api/v1/segments/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": {\n \"condition\": \"AND\",\n \"rules\": [\n {\n \"field\": \"clicked_count\",\n \"operator\": \"greater\",\n \"value\": 0\n },\n {\n \"field\": \"country_id\",\n \"operator\": \"equal\",\n \"value\": 225\n },\n {\n \"condition\": \"OR\",\n \"rules\": [\n {\n \"field\": \"leads_count\",\n \"operator\": \"equal\",\n \"value\": 1\n },\n {\n \"field\": \"sales_count\",\n \"operator\": \"equal\",\n \"value\": 1\n }\n ]\n },\n {\n \"field\": \"date_created\",\n \"operator\": \"equal\",\n \"value\": \"2023-07-05\"\n }\n ]\n },\n \"page\": 2,\n \"per_page\": 50\n}"
response = http.request(request)
puts response.read_body{
"total": 123,
"rows": [
{
"team_id": "<string>",
"phone_normalized": "<string>",
"contact_id": "<string>",
"foreign_id": "<string>",
"last_sent": "<string>",
"last_clicked": "<string>",
"sent_count": 123,
"clicked_count": 123,
"leads_count": 123,
"sales_count": 123,
"network_brand": "<string>",
"network_id": "<string>",
"network_reason": "<string>",
"phone_is_good": "<string>",
"phone_is_good_reason": "<string>",
"name": "<string>",
"country_id": "<string>",
"state_id": "<string>",
"state_id_reason": "<string>",
"custom1_str": "<string>",
"custom2_str": "<string>",
"custom3_str": "<string>",
"custom4_str": "<string>",
"custom5_str": "<string>",
"custom1_int": "<string>",
"custom2_int": "<string>",
"custom3_int": "<string>",
"custom4_int": "<string>",
"custom5_int": "<string>",
"custom1_dec": "<string>",
"custom2_dec": "<string>",
"custom1_datetime": "<string>",
"custom2_datetime": "<string>",
"custom3_datetime": "<string>",
"custom4_datetime": "<string>",
"custom5_datetime": "<string>",
"meta": "<string>",
"date_created": "<string>",
"date_updated": "<string>"
}
],
"stats": {},
"sql": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Available options:
numbers, emails Show child attributes
Show child attributes
Example:
{
"condition": "AND",
"rules": [
{
"field": "clicked_count",
"operator": "greater",
"value": 0
},
{
"field": "country_id",
"operator": "equal",
"value": 225
},
{
"condition": "OR",
"rules": [
{
"field": "leads_count",
"operator": "equal",
"value": 1
},
{
"field": "sales_count",
"operator": "equal",
"value": 1
}
]
},
{
"field": "date_created",
"operator": "equal",
"value": "2023-07-05"
}
]
}
Required range:
x >= 1Required range:
1 <= x <= 100⌘I