Api documentation

Api documentation

Get Car Photos By Car Style ID

Photos
 
 
v2 v1
 
 

Description

Get a car’s photos by its style ID.

URL

  1. https://api.edmunds.com/v1/api/vehiclephoto/service/findphotosbystyleid?styleId=3883&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. "styleId": "3883"
  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 = "<img src='http://media.ed.edmunds-media.com"+ res[0].photoSrcs[0] +"' />";
  21. }
  22. // Oops, Houston we have a problem!
  23. function fail(data) {
  24. console.log(data);
  25. }
  26. // Fire the API call
  27. res.api('/v1/api/vehiclephoto/service/findphotosbystyleid', options, success, fail);
  28. // Additional initialization code such as adding Event Listeners goes here
  29. };
  30. // Load the SDK asynchronously
  31. (function(d, s, id){
  32. var js, sdkjs = d.getElementsByTagName(s)[0];
  33. if (d.getElementById(id)) {return;}
  34. js = d.createElement(s); js.id = id;
  35. js.src = "path/to/sdk/file";
  36. sdkjs.parentNode.insertBefore(js, sdkjs);
  37. }(document, 'script', 'edmunds-jssdk'));
  38. </script>
  39. </body>
  40. </html>