Skip to content

Authentication

AVANSER User API requires users to login with their AVANSER username and password before making any further API calls.

When an application makes a login request, the API returns an access token that must be included with all API calls to identify the user. This access token is persistent and non-expiring.

If a user decides to logout of their AVANSER account, the application should make a logout request to remove the access token.

Login

Request

Request an access token to use in API calls. The access token is returned as a string in the data key.

Errors

Error CodeError TypeError Message
-1004ALREADY-LOGGED-INYou are already logged in
-1005MISSING-USERNAMEusername field missing
-1006MISSING-PASSWORDpassword field missing
-1008MISSING-DEVICEIDdeviceId field missing
-1030ERR_INVALID_USERInvalid username
-1028ERR_INVALID_PASSWORDPassword is not valid
-1029ERR_USER_LOCKOUTThis account has been locked due to too many incorrect login attempts
-1031ERR_PASSWORD_90EXPIRYPassword expired, please reset your password
-1032ERR_USER_6MEXPIRYUser has not been active in the last six month, please reset your password
-1020LOGIN-FAILEDInvalid username or password

ERR_INVALID_USER and ERR_INVALID_PASSWORD and the standard errors returned if the login credentials entered are incorrect. LOGIN-FAILED is a generic error returned if the login attempt fails for an unspecified reason. This may include an invalid username or password depending on the client that the user belongs to.

Query
usernamestringrequired

The user's AVANSER username.

passwordstringrequired

The user's AVANSER password.

deviceIdstringrequired

A string to uniquely identify the application requesting the access token. If a user could feasibility login to two instances of the same application (eg. two organisations in the same CRM), each of these should provide a unique deviceId (eg. by appending the organisation ID to the name of the application). This ensures that separate access tokens are generated for each instance, so that, for example, logging out of one instance doesn't remove access from the other.

devicestringrequired

Identifier of the mobile handset, "ios" for APPLE and "adt" for ANDROID

curl -i -X POST \
  'https://p3.avanser.com/app/login?username=string&password=string&deviceId=string&device=string'

Responses

Access token in data.

Bodyapplication/json
timestampintegerrequired

The time that the API response left the server, represented as the number of seconds since the UNIX epoch.

Example:1508903167
exectionnumber

The number of seconds that it took to process the API request.

Example:0.00041531896591187
errorbooleanrequired

Boolean indicating whether there was an error returned by the API request.

Example:false
datastringrequired

The data returned by the API. The format varies depending on the API function that was called.

Response
{ "timestamp": 1508903167, "exection": 0.00041531896591187, "error": false, "data": "13beb532cc997f2066d60eff65ea9d30" }