Aerpro JSONP API

This system has been reconfigured a few times now, having zero feedback from anyone, I'm "safely" assuming that nobody is actually using it. If you ARE actually using it, and want to continue using it, I suggest something like "registering" your use? That way we know it is actually being used by someone, and not just by us. WE USE THIS! This isn't some fly-by-night system that will never get updated, we use this on our homepage, and are developing against it for new features.

We encourage you to use the following system to access product SKU information related to vehicles, TDJ/Aerpro have spent a lot of time and money compiling this data, however if it helps you, please, use it! :D

POST API :-)

You'll need a curl switch to send post data, or use javascript/php etc. Something that can send a POST request to our Rest service.

While the previous API was rather difficult to use, this should be much easier!
The OLD API has been decomissioned .. a bit. If your script depended on it, well, I'm sorry, hopefully you told us about it and we notified you with plenty of time to change it! (If you haven't told us you were using our service, well, we just assume you aren't using it).

The aerpro.com homepage uses the new system, basically it listens for event: 'aerpro-status' and detects status: 'api-ready', then uses the data object attached. Obviously, aerpro.com doesn't actually need to make any API calls, but we listen for that anyway, as it means we can use the url for the vehicle which is in the data object. Sound complicated? Well, maybe, but it works!

You don't HAVE to register a function to use the plugin, for instance this is all we need on aerpro.com:

    (function($) {
        $(document).on('aerpro-status', function(e, a) {        
          if ((a.message == 'model-selected' && a.url) || (a.message == 'make-selected' && a.models == 0 && a.url)) {
              console.log('Navigating to: ' + a.url);
            window.location =  a.url;
           }
        });
        $('#aerpro-selector-here').aerproVehicleSelector();
        console.log("Aerpro selector has loaded.");
    })(jQuery);
   

Of course, if you want more than simple redirection to our website for the vehicle, then you'll likely want to do something else., like this in your function:

   $("#output-box a")
   .each(function()
   { 
      this.href = this.href.replace(/^https:\/\/aerpro\.com/, 
         "http://mysite.com");
   });
   

Ideally, you'd integrate it with your own platform, so a successful selection creates checkboxes for adding to a cart, comparing with other products, whatever you actually want the end user to do.

The minimum required to get a functioning version:

Insert iframe code.

The minimum required to get it integrated:

Basically though:

  1. Load jQuery
    <script src="https://code.jquery.com/jquery-1.11.3.min.js""></script>
  2. Load the plugin:
    <script src="https://aerpro.com/plugin.js""></script>
  3. Define a callback function:
    <script>window.WhatDoWeDo = function(data){ // Write whatever you like! }></script>
  4. Create a place for the plugin to exist:
    <div id="aerpro-selector-here"></div>
  5. Finally, tell the plugin to use the callback function on Model Select completion:
     $('#aerpro-selector-here').aerproVehicleSelector(WhatDoWeDo);

Essentially we use the http://aerpro.com/plugin.js as a datasource for vehicle data on the homepage selector, then register a function to operate on the success of that selection. For a fully working version on a foreign site, check out tdj.com.au/demo

Basically though:

Parameters/Options in REST API

Basically, make your calls to http://aerpro.com/api/rest, and send a JSON object via POST. Example from CLI, a search for a vehicle:

$ curl https://aerpro.com/api/rest -d '{"type":"vehicle","term":"camry"}'
  

Returns:

  {"received_request":{"type":"vehicle","term":"camry"},"warnings":[],"errors":[],"vehicle":[{"id":"18795","title":"Toyota Camry 1987-1992 SV21","url":"vehicles\/toyota\/toyota_camry_sv21_1987_1992","image":"images\/photo\/camry_sv21.png?itok=4xLAbBkJ"},{"id":"18792","title":"Toyota Camry ACV36R\/MCV36R  2002-08\/2006","url":"vehicles\/toyota\/toyota_camry_acv36r\/mcv36r_2002_08\/2006","image":"images\/photo\/ACV36R%29_Altise_sedan_08.jpg?itok=Q0AbfdEY"},{"id":"18793","title":"Toyota Camry ACV40R\/AHV40R  08\/2006-2011 (MY10)","url":"vehicles\/toyota\/toyota_camry_acv40r\/ahv40r_08\/2006_2011_my10","image":"images\/photo\/RAWRTHISONEEEEEE%5D_Camry_LE.jpg?itok=84VZ-j6L"},{"id":"19110","title":"Toyota Camry ASV50R 2012 -","url":"vehicles\/toyota\/toyota_camry_asv50r_2012","image":"images\/photo\/%20X50Camry_SE_--_02-29-2012.JPG?itok=W7WBpujH"},{"id":"18794","title":"Toyota Camry MCV20R\/SCV20R  1997-2002","url":"vehicles\/toyota\/toyota_camry_mcv20r\/scv20r_1997_2002","image":"images\/photo\/CURRENT_Toyota_Camry_%28MCV20R%29_Conquest_sedan_01.jpg?itok=ARCgqo7K"},{"id":"18796","title":"Toyota Camry XV10\/SDV10\/SXV10R  1993-1997","url":"vehicles\/toyota\/toyota_camry_xv10\/sdv10\/sxv10r_1993_1997","image":"images\/photo\/800px-1994-1995_Toyota_Camry_Vienta_%28VDV10%29_CSX_sedan_02.jpg?itok=ZbRRT2DJ"}]}
  
So, what if we wanted to see the products attached to those vehicles, what about the speakers spacer data? Another curl request!
You'll note, each of those returned Vehicle nodes has an "id" attribute, that is the one you need, eg:
  $  curl https://aerpro.com/api/rest -d '{"type":"vehicle","id":"18795"}'
  
Will return:
  {"received_request":{"type":"vehicle","id":"18795"},"warnings":[],"errors":[],"vehicle":{"make":"Toyota","model":"Camry","submodel":"SV21","year":"1987 - 1992","speaker_spaces":"Front: 3-1\/2\u0022, 5-1\/4\u0022|Rear: 6-3\/4\u0022|Dash: 3-1\/2\u0022|Front door: 5-1\/4\u0022|Rear deck: 6-3\/4\u0022","picture":"http:\/\/aerpro.com\/sites\/default\/files\/styles\/original\/public\/images\/photo\/camry_sv21.png?itok=Z-j-fovQ","dash":"http:\/\/aerpro.com\/sites\/default\/files\/styles\/original\/public?itok=tlUvutFR","products":["AP138","AP1398T","APP0140"]}}
  
As you can see, it includes the Dash image, the speaker spacer data, the list of SKU's associated. And an array of products!
  • Each product object contains details about the product. EG: weight, last-update, images, categories, full HTML description etc. Current API limits on SKU fetching is 30 nodes, just cause, if you need more, let us know, we can change it!
    • Main Parameter: "type"
      • "vehicle"
      • "product"
    • Secondary Parameters, dependant on first!
      • when {"type":"vehicle"}
        • Fetch by id, eg: {"type":"vehicle","id":"12345"}, will fetch details about a Vehicle with the id: 12345.
          Example usage:, sending {"type": "vehicle", "id":"18480"} to /api/rest would return:
        • Search by term, eg: {"type":"vehicle","term":"camry"}, will fetch a small amount of information about all matching vehicles. You can use the "id" attribute of results to perform detail requests as above.
      • when {"type":"product"}
        • Fetch by sku, eg: {"type":"product","products":["ABC123","ABC124"]}, will fetch details about BOTH products listed: ABC123 & ABC124.
        • Additional data available, just ask!

    Sound good?

    Please view the source to see how this works:

    Alternately, we have hosted a copy on another server: Try the foreign server demo here.

    Feedback extremely welcome, ideas/updates/changes etc, please feel free to help us make this service better!