REST API

Filtering & sorting

Filter and sort GET collection endpoints with the filter and sort request parameters.

Filtering

Filtering responses

curl -X GET \
  https://app.guestmanager.com/api/public/v2/events \
  -H 'Authorization: Token abcdefg' \
  -H 'Content-Type: application/json' \
  -d '{ "filter": { "id": "1,2,3" } }'

For GET requests to a collection, e.g. /events, you can filter data using the filter request parameter. Each endpoint lists the filters it accepts. Every endpoint that lists filters also accepts these two:

Parameter Format Example
filter[id] Comma separated string of IDs. "1,2,3"
filter[created_at][from] date or datetime 2018-05-25
filter[created_at][to] date or datetime 2018-05-25

A to date with no time covers that whole day. A date that can’t be parsed is ignored rather than rejected.

Endpoints that list no filters, such as Stations, Devices, Staff and Questions, accept none.

Boolean filters

Filters marked boolean take true or false. Any other value is ignored, so the filter is not applied.

Filters and ?deleted=true

filter[deleted] (on tickets, events and arrivals) chooses which records are listed. It is unrelated to the top-level ?deleted=true parameter, which only affects whether deleted related records appear inside an include.

Sorting

Sorting responses

curl -X GET \
  https://app.guestmanager.com/api/public/v2/events \
  -H 'Authorization: Token abcdefg' \
  -H 'Content-Type: application/json' \
  -d '{ "sort": { "starts_at": "asc" } }'

For GET requests to a collection, e.g. /events, you can sort responses using the sort request parameter. More details on which fields can be sorted on are described in the relevant endpoint.

Parameter Value
sort[{field}] asc or desc

Where you replace {field} with the field to sort on, and specify the value as asc or desc. You may sort on multiple fields.