Api documentation

Api documentation

Spec: Model

Spec Model
 
 
v3 v2
 
 

Description

Get model details based on different filters.

URL

  1. http://api.edmunds.com/api/vehicle/v3/models?makeNiceName={makeNiceName}&api_key={api key}&pageNum={pageNum}&pageSize={pageSize}

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 Models for the Honda</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. "makeNiceName": "honda",
  16. "pagenum": 1,
  17. "pagesize": 10
  18. };
  19. // Callback function to be called when the API response is returned
  20. function success(res) {
  21. var body = document.getElementById('results-body');
  22. body.innerHTML = "The first model id for Honda Civic is " +
  23. res.results[0].id;
  24. }
  25. // Oops, Houston we have a problem!
  26. function fail(data) {
  27. console.log(data);
  28. }
  29. // Fire the API call
  30. res.api('/api/vehicle/v3/models', options, success, fail);
  31. // Additional initialization code such as adding Event Listeners goes here
  32. };
  33. // Load the SDK asynchronously
  34. (function(d, s, id){
  35. var js, sdkjs = d.getElementsByTagName(s)[0];
  36. if (d.getElementById(id)) {return;}
  37. js = d.createElement(s); js.id = id;
  38. js.src = "path/to/sdk/file";
  39. sdkjs.parentNode.insertBefore(js, sdkjs);
  40. }(document, 'script', 'edmunds-jssdk'));
  41. </script>
  42. </body>
  43. </html>