Api documentation

Api documentation

Get TCO® for a Used Car

Price: True Cost to Own
 
 
v1
 
 

Description

Get the True Cost to Own® total for a used car. Make sure to see the Special Requirements for displaying the Edmunds True Cost to Own®.

URL

  1. https://api.edmunds.com/v1/api/tco/usedtruecosttoownbystyleidandzip/{style ID}/{zipcode}?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>Edmunds API Example</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. // Callback function to be called when the API response is returned
  16. function success(res) {
  17. var body = document.getElementById('results-body');
  18. body.innerHTML = "The True Cost to Own® is: " + res.value;
  19. }
  20. // Oops, Houston we have a problem!
  21. function fail(data) {
  22. console.log(data);
  23. }
  24. // Fire the API call
  25. res.api('/v1/api/tco/usedtruecosttoownbystyleidandzip/101426944/90019', options, success, fail);
  26. // Additional initialization code such as adding Event Listeners goes here
  27. };
  28. // Load the SDK asynchronously
  29. (function(d, s, id){
  30. var js, sdkjs = d.getElementsByTagName(s)[0];
  31. if (d.getElementById(id)) {return;}
  32. js = d.createElement(s); js.id = id;
  33. js.src = "path/to/sdk/file";
  34. sdkjs.parentNode.insertBefore(js, sdkjs);
  35. }(document, 'script', 'edmunds-jssdk'));
  36. </script>
  37. </body>
  38. </html>