Cria um segmento
curl --request POST \
--url https://kourio.app/v1/segments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"filter": {
"conditions": [
{
"field": "<string>",
"value": "<string>"
}
],
"match": "all"
},
"slug": "<string>",
"description": ""
}
'import requests
url = "https://kourio.app/v1/segments"
payload = {
"name": "<string>",
"filter": {
"conditions": [
{
"field": "<string>",
"value": "<string>"
}
],
"match": "all"
},
"slug": "<string>",
"description": ""
}
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({
name: '<string>',
filter: {conditions: [{field: '<string>', value: '<string>'}], match: 'all'},
slug: '<string>',
description: ''
})
};
fetch('https://kourio.app/v1/segments', 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://kourio.app/v1/segments",
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([
'name' => '<string>',
'filter' => [
'conditions' => [
[
'field' => '<string>',
'value' => '<string>'
]
],
'match' => 'all'
],
'slug' => '<string>',
'description' => ''
]),
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://kourio.app/v1/segments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"filter\": {\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"match\": \"all\"\n },\n \"slug\": \"<string>\",\n \"description\": \"\"\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://kourio.app/v1/segments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"filter\": {\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"match\": \"all\"\n },\n \"slug\": \"<string>\",\n \"description\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kourio.app/v1/segments")
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 \"name\": \"<string>\",\n \"filter\": {\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"match\": \"all\"\n },\n \"slug\": \"<string>\",\n \"description\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"filter": {
"match": "all",
"conditions": [
{
"field": "<string>",
"operator": "equals",
"value": "<string>"
}
]
},
"contactCount": 123,
"createdAt": "<string>",
"updatedAt": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}Público
Cria um segmento
Segmento é um filtro, não uma cópia: ele é reavaliado a cada envio, então quem entrar na base amanhã e casar o filtro entra na próxima campanha sem ninguém mexer.
POST
/
v1
/
segments
Cria um segmento
curl --request POST \
--url https://kourio.app/v1/segments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"filter": {
"conditions": [
{
"field": "<string>",
"value": "<string>"
}
],
"match": "all"
},
"slug": "<string>",
"description": ""
}
'import requests
url = "https://kourio.app/v1/segments"
payload = {
"name": "<string>",
"filter": {
"conditions": [
{
"field": "<string>",
"value": "<string>"
}
],
"match": "all"
},
"slug": "<string>",
"description": ""
}
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({
name: '<string>',
filter: {conditions: [{field: '<string>', value: '<string>'}], match: 'all'},
slug: '<string>',
description: ''
})
};
fetch('https://kourio.app/v1/segments', 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://kourio.app/v1/segments",
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([
'name' => '<string>',
'filter' => [
'conditions' => [
[
'field' => '<string>',
'value' => '<string>'
]
],
'match' => 'all'
],
'slug' => '<string>',
'description' => ''
]),
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://kourio.app/v1/segments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"filter\": {\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"match\": \"all\"\n },\n \"slug\": \"<string>\",\n \"description\": \"\"\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://kourio.app/v1/segments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"filter\": {\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"match\": \"all\"\n },\n \"slug\": \"<string>\",\n \"description\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kourio.app/v1/segments")
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 \"name\": \"<string>\",\n \"filter\": {\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"match\": \"all\"\n },\n \"slug\": \"<string>\",\n \"description\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"filter": {
"match": "all",
"conditions": [
{
"field": "<string>",
"operator": "equals",
"value": "<string>"
}
]
},
"contactCount": 123,
"createdAt": "<string>",
"updatedAt": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}Autorizações
Sua chave de API.
Corpo
application/json
Resposta
O recurso foi criado.
Show child attributes
Show child attributes
⌘I