Version 2 (v2)

Filtering

The Administrate API provides a set of filters which are useful for requesting a restricted set of results to avoid further processing and reduce bandwidth. This allows the possiblity to return records between a set of dates, for example, or all those records that belong to a list of ids.

Available Filters

NameOperatorUsage
Less than__ltattribute__lt=[value]
Less than or equal to__lteattribute__lte=[value]
Greater than__gtattribute__gt=[value]
Greater than or equal to__gteattribute__gte=[value]
Equals__eqattribute__eq=[value]
Belongs to__inattribute__in=value_1[,value_2]*
Does not belong to__notinattribute__notin=value_1[,value_2]*

Date time filtering

Date time fields are required to be ISO compliant. Most fields are not time zone aware and hence need to be provided without an offset. Contrarily, time zone aware fields are required to have an offset. An example of both forms can be found below:

Date time ISO formats examples

TypeExample
ISO datetime without offset2017-12-20T18:00:00
ISO datetime with offset2017-12-20T18:00:00+01:00

Ordering

You can order the results by using a query parameter of ‘_order=field’. To order by multiple fields, simply comma separate them: ‘_order=field1,field2’. To order in descending order, place a dash in front of the field name: ‘_order=-field1,field2’.

Example

curl -k -u <username>:<password> \
     https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/accounts?_order=first_name

Limiting

You can limit the results by using a query parameter of ‘_limit=N’ where N is an integer.

Example

curl -k -u <username>:<password> \
     https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/accounts?_limit=10

Pagination

You can paginate through large sets of data by making multiple requests and combining a ‘__gt’ filter, ‘_order’, and ‘_limit’. On the first request, you would request records where id > 0, ordering by id, and returning 100 records:

First request

curl -k -u <username>:<password> \
     https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/accounts?id__gt=0&_order=id&_limit=100

The next request would use the last id from the previous request as the ‘__gt’ filter:

Second request

curl -k -u <username>:<password> \
     https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/accounts?id__gt=100&_order=id&_limit=100

You would continue this until 0 results are returned.