Table of Contents

Filter Operators

The number of records returned by an endpoint is usually determined by the query parameters appended to the URL. RedBook Direct API aids this process by providing a set of special operators, detailed below with example requests.

Tip

Filters combine freely with Pagination and Projections. Several examples below use projection to keep the responses short.

Range: range(start..end)

To filter within a range, use the range operator. The .. (two dots) between the edge values is inclusive of both.

For example, to get vehicles from 2015 to 2017 (both inclusive), use range(2015..2017), which evaluates to 2015, 2016 and 2017:

curl -H "Authorization: Bearer {access-token}" \
  "https://api.redbookdirect.com/v1/au/car/vehicles?familyid=29447&year=range(2015..2017)&BodyStyle=Sedan&projection=redbookcode,yeargroupyear:year,description&limit=3"
{
  "limit": 3,
  "offset": 0,
  "currentCount": 3,
  "totalCount": 19,
  "results": [
    { "redbookcode": "AUVSUBA2015AEAA", "year": 2015, "description": "6GEN 2.5i Sedan 4dr CVT 6sp AWD [MY15]" },
    { "redbookcode": "AUVSUBA2015AEAB", "year": 2015, "description": "6GEN 2.5i Premium Sedan 4dr CVT 6sp AWD [MY15]" },
    { "redbookcode": "AUVSUBA2015AEAC", "year": 2015, "description": "6GEN 3.6R Sedan 4dr CVT 6sp AWD 3.6i [MY15]" }
  ]
}

Not Equal: not({value})

Returns records where the attribute does not equal the value. The example below gets makes with body styles that are not Sedan:

curl -H "Authorization: Bearer {access-token}" \
  "https://api.redbookdirect.com/v1/au/car/makes?year=2015&BodyStyle=not(Sedan)&projection=Id,Name,VehicleCount"

In: in({value})

Specifies multiple values while filtering on an attribute. The example below gets makes whose body style is either Sedan or Wagon:

curl -H "Authorization: Bearer {access-token}" \
  "https://api.redbookdirect.com/v1/au/car/makes?familyid=29447&year=2015&BodyStyle=in(Sedan,Wagon)&projection=id,name,vehicleCount"

NotIn: not.in({value})

The opposite of in. The example below gets makes whose body style is neither Sedan nor Wagon:

curl -H "Authorization: Bearer {access-token}" \
  "https://api.redbookdirect.com/v1/au/car/makes?year=2015&BodyStyle=not.in(Sedan,Wagon)&projection=Id,Name,VehicleCount"

Greater Than: gt({value})

Works on number attributes. The example below gets vehicles manufactured after 2020:

curl -H "Authorization: Bearer {access-token}" \
  "https://api.redbookdirect.com/v1/au/car/vehicles?familyid=29447&year=gt(2020)&BodyStyle=Sedan&projection=redbookcode,yeargroupyear:year,description"

Greater Than or Equal: gte({value})

Works on number attributes. The example below gets vehicles manufactured in and after 2020 (including 2020):

curl -H "Authorization: Bearer {access-token}" \
  "https://api.redbookdirect.com/v1/au/car/vehicles?familyid=29447&year=gte(2020)&BodyStyle=Sedan&projection=redbookcode,yeargroupyear:year,description&limit=3"

Less Than: lt({value})

Works on number attributes. The example below gets vehicles less than 2 years old:

curl -H "Authorization: Bearer {access-token}" \
  "https://api.redbookdirect.com/v1/au/car/vehicles?familyId=29447&vehicleageyears=lt(2)&BodyStyle=Sedan&projection=redbookcode,yeargroupyear:year,description,vehicleageyears&limit=3"

Less Than or Equal: lte({value})

Works on number attributes. The example below gets vehicles 2 years old or newer (including cars that are exactly 2 years old):

curl -H "Authorization: Bearer {access-token}" \
  "https://api.redbookdirect.com/v1/au/car/vehicles?familyId=29447&vehicleageyears=lte(2)&BodyStyle=Sedan&projection=redbookcode,yeargroupyear:year,description,vehicleageyears&limit=3"