Projections
The attributes an endpoint can return are determined at the time of account creation. The user can
select which of the available attributes they want returned, and give each a name of their choice,
using the projection query parameter. This controls the breadth of the result set.
Consider a call to the Makes/1341 endpoint:
curl -H "Authorization: Bearer {access-token}" \
"https://api.redbookdirect.com/v1/au/car/makes/1341"
{
"id": 1341,
"name": "Abarth",
"startyear": 2011,
"latestyear": 2020,
"vehiclecount": 102,
"_links": {
"self": "/v1/au/car/Makes/1341",
"families": "/v1/au/car/Families?makeid=1341"
}
}
Choosing attributes
Customise the output to return only Id, Name and StartYear. This works on a list or a single
object.
curl -H "Authorization: Bearer {access-token}" \
"https://api.redbookdirect.com/v1/au/car/makes/1341?projection=Id,Name,StartYear"
{
"id": 1341,
"name": "Abarth",
"startyear": 2011
}
Renaming attributes
Attributes can be renamed using the Attribute:NewName syntax. Here id is renamed to
identification, name to makename and startyear to earliestYear.
curl -H "Authorization: Bearer {access-token}" \
"https://api.redbookdirect.com/v1/au/car/makes/1341?projection=Id:Identification,Name:MakeName,StartYear:EarliestYear"
{
"identification": 1341,
"makename": "Abarth",
"earliestyear": 2011
}