Management - Login User

Use this api call to get a ticketId valid for api calls for a pre-defined time in seconds. A ticketId can be used to provide credentials with an expiring token. A ticketId can be used instead of a login/ password combination. Utilize this function to perform api calls without sending login details for each api call.

API Usage

In order to get a ticketId for an Opentracker.net account, use this URL to perform a GET or POST request.

Parameters

The following parameters are required:


login: is the email used to login to opentracker.net, with the associated permissions/ roles.
password: the password of the user/email account.
expires: time in seconds in which the ticket expires. The default is [60] seconds.

Standard response

Page returns a ticketId when request successful. An example is 1c422da0-e01f-4261-91d6-2e8fab86be17

The ticketId can be used for other api calls.

If an error occurs (for example wrong login/ password combination) then false is returned.

Example work flow

1. get a ticketId that expires in 600 seconds

https://api.opentracker.net/api/management/login_user.jsp?login=myLogin&password=myPassword&expires=600

should return for example 1c422da0-e01f-4261-91d6-2e8fab86be17
2. get the top pages statistics for a site (This api call might not works if this token is expired)
http://api.opentracker.net/api/top_lists/top_pages.jsp?ticketId=1c422da0-e01f-4261-91d6-2e8fab86be17&site=www.opentracker.net

Errors

false if an error occurs.

Authorization Tokens

Opentracker supports an authorization-token (aka ticket-id system), for users who want to use a random-uuid instead of using the login and a password in an api-call.
https://api.opentracker.net/api/management/login_user.jsp is the api call used to create an authorization token/ ticketId.

An authorization-token / ticketId is created by passing your login and password, for example:
https://api.opentracker.net/api/management/login_user.jsp?login=demo@opentracker.net&password=demo123

The output generated is your new token id. Here is an example:
bee265fd-8150-4da8-a5df-12251aa4d0f7

If the api call is not successful, then ‘false’ is returned.

The token is valid for 60 seconds by default.
The time frame can be increased by passing the duration in seconds as the parameter “expires”.
For example, in order to create a token which expires after an hour, the api call would look like this:
https://api.opentracker.net/api/management/login_user.jsp?login=demo@opentracker.net&password=demo123&expires=3600

With tokens, you can access data from all api calls instead of passing login and password parameters. For example, the 'top pages' (most popular pages) api call can be accessed as follows:
https://api.opentracker.net/api/top_lists/top_pages.jsp?ticketId=bee265fd-8150-4da8-a5df-12251aa4d0f7&site=www.opentracker.net

Note: After the expiration of the token, it is no longer possible to access the api call, and an exception occurs, stating that the ticket id is not valid.

You can confirm if your token is valid or not by use of the following api call :
https://api.opentracker.net/api/management/is_valid_ticket.jsp
Api calls returns 1 ticketId is valid, else 0 otherwise.

We would love to hear your feedback. Please use the facebook comment box below