Welcome to the KeeResources KWIKview API



API Version 2 released!

We have grouped the api's to reflect our new pricing model, so it's clearer which api's are free and which are not. The free stuff is in the API Docs Lookup section.
Yes, you can search for vehicles and return some details about an individual vehicle for *free when signed up to the Public API package.

Pricing Information?
To decide which package is right for you, please contact KeeResources Sales on +44(0)333 444 4411 or email to sales@keeresources.com

Breaking Changes?
There should be none, other than changing your api method calls to use v2 instead of v1. But of course, please test your application code first before upgrading.
Check the Breaking Changes document here for further details.


Will version 1 still work?
Yes. You are in control when to upgrade. We will retire version 1 eventually but will give plenty of notice and time for you to plan for this.

Need V1 Documentation?
You can find previous versions by changing the URL in the Explore banner at the top of the API Docs page to https://kwikviewapi.keeresources.com:443/api/swagger/docs/v1

*Free, subject to fair usage, terms and conditions.



Overview

This API provides access to the KeeResources KWIKview platform on a subscription basis, enabling you to search for vehicles and retrieve vehicle descriptions, configurations and more.

Features include;




Getting Started

  1. At the moment this API requires you to have an account with us and authenticate before you can call these api's. To get up and running, please contact KeeResources Sales on +44(0)333 444 4411 or email to sales@keeresources.com

  2. Once you have an account registered and verified, and subscriptions allocated, you will be able to start calling the api's. The api's available and documentation are here API Documentation or from the Swagger API Docs menu above.

  3. The first api call you need to make is the login and authenticate method. Once you authenticate with your user id and password, we issue a bearer token. Each subsequent api method expects to see the bearer token in the request header. If no bearer token is supplied an unauthorised response will be returned. Bearer tokens will expire after a period of time, so you will need to authenticate again from time to time to get a new freshly baked token.




Walkthrough

Have a browse of the API documentation. We are using Swagger to provide the api documentation, and this allows us to give you a Try it out button. You can of course use other tools to try out these api's.

So, lets authenticate and get a bearer token and try some api's out for a test run!

  1. One of the api methods is Authenticate token which returns that important bearer token we need to gain access. Find the /token api in the documentation and expand the details to see the input parameters.

  2. To get a bearer token, input in the grant_type the value password and your account username and password (the details you used to register with). Click the Try it out button.

  3. Copy that access_token... the Q12Gs....etc to your Clipboard (you don't need the quotes, just the token contained within.) Remember to generate your own token, it is unique to you and only valid for a while.

  4. Screenshot.




  5. Now in the api_key box at the top of the page, input the text bearer followed by the token. Paste it into the box from your Clipboard.

  6. Screenshot.




  7. Thats it! We are ready now to try some of the api's. So lets search for some vehicles.

  8. Here is an example using the vehicle search api. Simply input a search string and go.

  9. Screenshot.





  10. You can see the request, the bearer token being sent up in the request header and of course the response back.




Developer Notes

The api documention is a work in progress! We are working to improve it.

Abuse of these API's may result in us withdrawing access to them and your account.

Other features of note are;




A JavaScript Example.


Step 1

First thing is to call the api/token method to authenticate and login. Once we do this we get a bearer token back. This bearer token needs to be provided on each subsequent call in the call header. This saves us passing username and passwords on every call. It’s a good idea to store the bearer token, and here I’m using the browsers sessionStorage.

var baseUrl = ‘https://api.keeresources.com/api/’;
var tokenKey = 'accessToken';

login = function () {
    var loginData = {
    grant_type: 'password',
    username: ‘yourusername’,
    password: ‘yourpassword’
  };

  console.log('Calling login api');

  $.ajax({
    type: 'POST',
    url: baseUrl + '/Token',
    data: loginData
  }).done(function (data) {
    console.log('Completed login api');
    console.log(data.userName);
    // Cache the access token in session storage.
    sessionStorage.setItem(tokenKey, data.access_token);
  }).fail(showError);
}

You should catch any errors by writing/completing the showError function. NOTE: Bearer tokens last about a day, but can expire at any time. So when writing client code to call these api’s, if you get an unauthorized response you should have some retry logic that calls the login method again to get a new freshly based token and then try the api call again.


Step 2

Once you have that bearer token, you are ready to call the rest of the available api’s. Here’s an example just calling the vehicle detail. First I get the bearer token and add it to the headers.Authorization. Then simply setup the in parameters (a KwikId) and make the call.

callVehicleDetailApi = function () {
  var token = sessionStorage.getItem(tokenKey);
  var headers = {};
  if (token) {
    headers.Authorization = 'Bearer ' + token;
  }

  var payload = {
    KwikId: 123456
  }

  console.log('Calling Vehicle Detail api');

  $.ajax({
    type: 'GET',
    url: baseUrl + '/api/v2/vehicle',
    data: payload,
    headers: headers
  }).done(function (data) {
    console.log('Completed vehicle detail api');
    console.log("KEEDesc:" + data.KeeDesc);
    console.log(data);
  }).fail(showError);
}

By default we return JSON formatted data as that is usually the most efficient. But you can specify Xml in the headers if that’s what you want.


Step 3

Well there isn’t really any step 3. Except you might want to logout – but you don’t need to do anything except forget the bearer token.

  logout = function () {
    sessionStorage.removeItem(tokenKey)
  }



Feedback

We welcome feedback on the api's and any additional features you might like to see in future versions.

Feel free to contact KeeResources Sales on +44(0)333 444 4411 to discuss or email your suggestions and feedback to sales@keeresources.com