API MERLO
SUMMARY
Merlo 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 Merlo Mobility account and its credentials; to put it simply, if you can login at Merlo Mobility you are ready to go.
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 like this (note: the following example uses JavaScript and jQuery, it’s not mandatory to use them):
$.ajax({
type: 'GET',
url: 'https://merlomobility.merlo.com/myMerlo/users/login'
data: {username: your_username, password: your_password},
success: function(answer) {
var your_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://merlomobility.merlo.com/myMerlo/users/logout',
headers: {
'Authorization': 'Bearer ' + your_token
},
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. An easy way to check if the token is still valid is to make a request to “/user/me” and look for the response code, if it’s 200 the token it’s still valid, if it’s 401 the token is expired.