Skip to content

Collection filters

LOX24 API provides a generic system to apply filters and sort criteria on collections. You can see which filters you can use in the property description.

The API uses two types of the text filters:

  • partial strategy uses provided text to search for fields that contain part of that text
  • exact strategy uses uses provided text to search for fields that contain exactly that text

Note: Search filters with the exact strategy can have multiple values for the same property (in this case the condition will be similar to a SQL IN clause).

Find sms which phone property contains “4979” and text property contains *“hello”:

curl -X GET https://api.lox24.eu/sms?phone=4979&text=hello \
-H 'Host: api.lox24.eu' \
-H 'X-LOX24-AUTH-TOKEN: e3f3a759b6677959b6ebfcxxxxxxxxxx' \
-H 'X-LOX24-CLIENT-ID: 1234567'

Find sms with country iso2 property equal ‘DE’ OR ‘CH’ and status_code = 0

curl -X GET https://api.lox24.eu/sms?iso2[]=DE&iso2[]=CH&status_code=0 \
-H 'Host: api.lox24.eu' \
-H 'X-LOX24-AUTH-TOKEN: e3f3a759b6677959b6ebfcxxxxxxxxxx' \
-H 'X-LOX24-CLIENT-ID: 1234567'

The boolean filter allows to search on boolean fields and values.

Syntax: ?property=<true|false|1|0>

Get sms which wasn’t sent to the mobile operator yet:

curl -X GET https://api.lox24.eu/sms?sent=0 \
-H 'Host: api.lox24.eu' \
-H 'X-LOX24-AUTH-TOKEN: e3f3a759b6677959b6ebfcxxxxxxxxxx' \
-H 'X-LOX24-CLIENT-ID: 1234567'

The exists filter allows to select items based on a nullable field value

Syntax: ?exists[property]=<true|false|1|0>

Get bulks which has property is_unicode=null (sms encoding auto-detection):

curl -X GET https://api.lox24.eu/bulks?exists[is_unicode]=0 \
-H 'Host: api.lox24.eu' \
-H 'X-LOX24-AUTH-TOKEN: e3f3a759b6677959b6ebfcxxxxxxxxxx' \
-H 'X-LOX24-CLIENT-ID: 1234567'

The range filter allows to filter by a value lower than, greater than, lower than or equal, greater than or equal and between two values.

Syntax: ?property[<lt|gt|lte|gte|between>]=value

Filter sms collection by the field created_at between 1575158400 (2019-12-01) and 1575676800 (2019-12-07):

curl -X GET https://api.lox24.eu/sms?created_at[between]=1575158400..1575676800 \
-H 'Host: api.lox24.eu' \
-H 'X-LOX24-AUTH-TOKEN: e3f3a759b6677959b6ebfcxxxxxxxxxx' \
-H 'X-LOX24-CLIENT-ID: 1234567'

The order filter allows you to sort a collection against the given properties. Order parameter _order.

Sort sms collection by the field ‘created_at’ in descending order:

curl -X GET https://api.lox24.eu/sms?_order[created_at]=desc \
-H 'Host: api.lox24.eu' \
-H 'X-LOX24-AUTH-TOKEN: e3f3a759b6677959b6ebfcxxxxxxxxxx' \
-H 'X-LOX24-CLIENT-ID: 1234567'