Ir al contenido

Cuantos contactos caen en unas reglas

POST
/v1/bulk/segments/preview
curl --request POST \
--url https://api.mailerdash.com/v1/bulk/segments/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "rules": { "match": "all", "rules": [ { "field": "tag", "op": "has", "value": "vip" }, { "field": "engagement", "op": "opened", "days": 30 } ] }, "list_id": "example", "limit": 10 }'

Evalua las reglas SIN guardarlas y devuelve el total mas una muestra. Va como POST porque las reglas son un objeto anidado. Es la mitad de la feature: un segmento que resuelve a 0 o a la lista entera es el error caro, y sin verlo antes nadie lo nota hasta despues de mandar.

Media type application/json
object
rules

Reglas del segmento. match: all exige que se cumplan todas; any, que se cumpla alguna.

object
match
string
default: all
Allowed values: all any
rules
Array<object>
object
field
required
string
Allowed values: tag status engagement created list custom
op
required

Tag: has|not_has - status: is|is_not - engagement: opened|not_opened|clicked|not_clicked - created: before|after - list: in|not_in - custom: is|is_not|contains|exists|not_exists

string
value
string
days
integer
>= 1 <= 3650
field_name

Nombre del custom field dentro de metadata.

string
Example
{
"match": "all",
"rules": [
{
"field": "tag",
"op": "has",
"value": "vip"
},
{
"field": "engagement",
"op": "opened",
"days": 30
}
]
}
list_id
string
limit
integer
default: 10

Total y muestra

Media type application/json
object
total
integer
sample
Array<object>
object
email
string
name
string
status
string
Example generated
{
"total": 1,
"sample": [
{
"email": "example",
"name": "example",
"status": "example"
}
]
}

Reglas invalidas

No autorizado