Api documentation

Api documentation

Get a List of Car Model Years for a Specific Car Make/Model

Spec Model/Year
 
 
v3 v2
 
 

Description

Get model year details, including styles and trims, for a specific car make/model.

URL

  1. http://api.edmunds.com/api/vehicle/v2/{make}/{model}/years?fmt=json&api_key={api key}

Code Example

You need the Javascript SDK to run this example.

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset=utf-8>
  5. <title>Get a list of model years for the Honda Civic</title>
  6. </head>
  7. <body>
  8. <div id="results-body"></div>
  9. <script>
  10. window.sdkAsyncInit = function() {
  11. // Instantiate the SDK
  12. var res = new EDMUNDSAPI('YOUR API KEY');
  13. // Optional parameters
  14. var options = {
  15. "state": "new"
  16. };
  17. // Callback function to be called when the API response is returned
  18. function success(res) {
  19. var body = document.getElementById('results-body');
  20. body.innerHTML = "The model year for a new Honda Civic is " +
  21. res.years[0].year;
  22. }
  23. // Oops, Houston we have a problem!
  24. function fail(data) {
  25. console.log(data);
  26. }
  27. // Fire the API call
  28. res.api('/api/vehicle/v2/honda/civic/years', options, success, fail);
  29. // Additional initialization code such as adding Event Listeners goes here
  30. };
  31. // Load the SDK asynchronously
  32. (function(d, s, id){
  33. var js, sdkjs = d.getElementsByTagName(s)[0];
  34. if (d.getElementById(id)) {return;}
  35. js = d.createElement(s); js.id = id;
  36. js.src = "path/to/sdk/file";
  37. sdkjs.parentNode.insertBefore(js, sdkjs);
  38. }(document, 'script', 'edmunds-jssdk'));
  39. </script>
  40. </body>
  41. </html>