Cuantos contactos caen en unas reglas
POST
/v1/bulk/segments/preview
const url = 'https://api.mailerdash.com/v1/bulk/segments/preview';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"rules":{"match":"all","rules":[{"field":"tag","op":"has","value":"vip"},{"field":"engagement","op":"opened","days":30}]},"list_id":"example","limit":10}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Sección titulada «Authorizations »Request Body required
Sección titulada «Request Body required » Media type application/json
object
rules
Reglas del segmento. match: all exige que se cumplan todas; any, que se cumpla alguna.
object
match
string
rules
Array<object>
object
field
required
string
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
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
Responses
Sección titulada « Responses »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