Search By Model
In the final chapter let's take a look how to build more complicated module with chain of api calls.
If you play By Vehicle search block, you can see that
Year and Model
dropdowns refreshed with data matching choosed parameters.
Let's repeat this functionality.


This is just List of Manufacturers.
GET /v1/makes/ HTTPS/1.1
Host: api.wheel-size.com
[
{
"slug": "acura",
"name": "Acura"
},
{
"slug": "alfa-romeo",
"name": "Alfa Romeo"
},
{
"slug": "aston-martin",
"name": "Aston Martin"
},
{
"slug": "audi",
"name": "Audi"
},
...
]
Use slug of the manufacturer as make query parameter for /years/ API method.

This is list of years matching given manufacturer.
You can see that slug
and name are always the same.
slug field here is just to keep uniform way
to present list of same-type resources.
GET /v1/years/?make=chevrolet HTTPS/1.1
Host: api.wheel-size.com
[
{
"slug": 2015,
"name": 2015
},
{
"slug": 2014,
"name": 2014
},
{
"slug": 2013,
"name": 2013
},
{
"slug": 2012,
"name": 2012
},
{
"slug": 2011,
"name": 2011
},
...
]
Use slug of the manufacturer as make and slug of the year as year query parameters for /models/ API method.

This is List of Models.
GET /v1/models/?make=chevrolet&year=2014 HTTPS/1.1
Host: api.wheel-size.com
[
{
"slug": "avalanche-1500",
"name": "Avalanche 1500"
},
{
"slug": "avalanche-2500",
"name": "Avalanche 2500"
},
{
"slug": "aveo",
"name": "Aveo"
},
{
"slug": "camaro",
"name": "Camaro"
},
{
"slug": "cobalt",
"name": "Cobalt"
},
{
"slug": "colorado",
"name": "Colorado"
},
{
"slug": "corvette",
"name": "Corvette"
},
...
]
Use slug of the manufacturer as make, slug of the year as year, and slug of the model as model query parameters for /search/by_model/ API method.

/search/by_model/ is exactle the same as
/vehicles/ method.
Another name created just for purposes of convenience.
See Detailed Info About Model for Specified Year for more information.
GET /v1/search/by_model/?make=chevrolet&year=2014&model=aveo HTTPS/1.1
Host: api.wheel-size.com
[
{
"market": {
"abbr": "EUDM",
"name": "European domestic market"
},
"body": null,
"trim": "1.4",
"stud_holes": 5,
"pcd": 105.0,
"centre_bore": 56.5,
"lock_type": "nut",
"lock_text": "M12 x 1.5",
"bolt_pattern": "5x105",
"wheels": [
{
"showing_fp_only": true,
"is_stock": true,
"front": {
"rim": "5.5Jx14 ET39",
"rim_diameter": 14,
"rim_width": 5.5,
"rim_offset": 39.0,
"tire": "185/75 R14",
"tire_sizing_system": "metric",
"tire_construction": "R",
"tire_width": 185,
"tire_aspect_ratio": 75,
"tire_diameter": null,
"tire_section_width": null,
"tire_is_82series": false
},
"rear": {
"rim": "",
"rim_diameter": null,
"rim_width": null,
"rim_offset": null,
"tire": "",
"tire_sizing_system": "metric",
"tire_construction": "R",
"tire_width": null,
"tire_aspect_ratio": null,
"tire_diameter": null,
"tire_section_width": null,
"tire_is_82series": false
}
},
...
]
},
...
]