Skip to main content

Constructing Filters and Sorts


  • Each filter is wrapped in a q[] block.
  • Inside each q[] block is a condition (an attribute combined with a predicate).
  • Each query parameter is assigned a value.


  • Sorts still include a q[] block, but follow a slightly different syntax: q[s]=attribute+order
  • order can be asc or desc
  • The default sort order is asc if no order is passed. So, q[s]=attribute is also valid.

The Filter Parameter


The condition represents which properties to use for filtering and how to filter them, but we still need a target value to apply. For example, to retrieve all vehicles where the color is "red", you can pass red as the value to the q[color_eq]= filter parameter. If you want all vehicles with an id greater than 100, you can pass 100 as the value to q[id_gt]=.

Bringing it Together

Let's say that you want to construct a filter that returns all Vehicles created after January 1st, 2016. You take the attribute, created_at, and join it with the gteq predicate with an underscore, then wrap it in q[], and set the value to 2016-01-01.


To retrieve the same result set, but filtering out vehicles that have no license plate, add another filter using the null predicate:


The Sort Parameter

You can sort by any attribute in Fleetio. Sorts can be passed by themselves, or combined with filters. Here's what a sort could look like appended to the above examples: