API MERLO

SUMMARY

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

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

HOW TO ACCESS IT

$.ajax({
type: 'GET',
url: 'https://api.movimatica.com/rest2/user/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://api.movimatica.com/rest2/user/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.