API Wirail

SUMMARY

Wirail API will let you interact with our system in many different ways:

  • you can request, send and modify data about activities, vehicles and all the other things your account has access to
  • you can interact with vehicles and their features, for example engine lock and telemetry data collection
  • you can download the periodical reports we generate and upload your own activities by sending their data as a JSON object

This is just a brief list of the available features, click here for the complete documentation.

HOW TO ACCESS IT

To access the API you only need a Wirail account and its credentials; The first step is to login using the API to get the token required for every other operation.
You have to send a login request with your credentials (JSON type) like this (note: the following example uses JavaScript and jQuery, it’s not mandatory to use them):

$.ajax({
  type: 'POST',
  url: 'https://api.wirail.tech/login/user/login',
  data: {username: your_username, password: your_password},
  success: function(answer) {
    var your_token = answer. Token;
  }
});

Explanation: this is an example of login request, if it is successful it returns an object (answer) containing the token (answer. Token).

HOW TO USE IT

Once you have the token you have to include it in the requests like this (note: the following example uses JavaScript and jQuery, it’s not mandatory to use them):

$.ajax({
  type: 'GET',
  url: 'https://api.wirail.tech/login/client/profile',
  headers: {
    'Authorization': 'Bearer... '
  },
  success: function(answer) {
    . . .
  }
});

The token (your_token) is included in the request headers and preceded by ‘Authorization’: ‘Bearer’.
That’s it, all the non-login requests will follow this syntax and return data that can be used by the users as they want.

ABOUT THE TOKEN

The token expires after some time and you will have to login again to get a new one.
If the token is not expired you don’t have to login as the system recognizes an user by the token assigned to it.