Horizontal Filtering

You can filter result rows by adding conditions on columns. For instance, to lookup contacts that did not receive any campaign messages this month:

curl "https://integration.getmateo.com/api/v1/contact?campaign_messages_this_month=eq.0"

You can evaluate multiple conditions on columns by adding more query string parameters. For instance, to return contacts that did not receive any campaign messages this month and opted in for WhatsApp marketing:

curl "https://integration.getmateo.com/api/v1/contact?campaign_messages_this_month=eq.0&whatsapp_marketing_opt_in=eq.true"

Operators

These operators are available:

AbbreviationMeaning
eqequals
gtgreater than
gtegreater than or equal
ltless than
lteless than or equal
neqnot equal
likeLIKE operator (to avoid URL encoding you can use * as an alias of the percent sign % for the pattern)
ilikeILIKE operator (to avoid URL encoding you can use * as an alias of the percent sign % for the pattern)
inone of a list of values, e.g. ?a=in.(1,2,3) — also supports commas in quoted strings like ?a=in.("hi,there","yes,you")
ischecking for exact equality (null,true,false,unknown)
isdistinctnot equal, treating NULL as a comparable value
cscontains e.g. ?tags=cs.{example, new}
cdcontained in e.g. ?values=cd.{1,2,3}
notnegates another operator, see Logical Operators
orlogical OR, see Logical Operators
andlogical AND, see Logical Operators

Logical Operators

Multiple conditions on columns are evaluated using AND by default, but you can combine them using OR with the or operator. For example, to return contacts with either a SMS or a WhatsApp marketing opt in:

curl "https://integration.getmateo.com/api/v1/contact?or=(whatsapp_marketing_opt_in.eq.true,email_marketing_opt_in.eq.true)"

To negate any operator, you can prefix it with not like ?a=not.eq.2 or ?not.and=(a.gte.0,a.lte.100).

Vertical Filtering

To be more effiecient, it is always wise to retrieve only the columns you need. You can do this by specifying the columns in the select query string parameter. For example, to retrieve only the id and name columns:

curl "https://integration.getmateo.com/api/v1/contact?select=id,name"

Ordering

The reserved word order reorders the response rows. It uses a comma-separated list of columns and directions:

curl "https://integration.getmateo.com/api/v1/contact?order=full_name.desc,email.asc"

If no direction is specified it defaults to ascending order:

curl "https://integration.getmateo.com/api/v1/contact?order=full_name"

If you care where nulls are sorted, add nullsfirst or nullslast:

curl "https://integration.getmateo.com/api/v1/contact?order=full_name.nullsfirst"
curl "https://integration.getmateo.com/api/v1/contact?order=full_name.nullslast"