Académique Documents
Professionnel Documents
Culture Documents
INTRODUCTION .............................................................................................................................................. 5
REQUIREMENTS ............................................................................................................................................. 6
INSTALLATION................................................................................................................................................ 7
OTHER OS ........................................................................................................................................................ 7
Options ........................................................................................................................................................ 8
SETTINGS ........................................................................................................................................................ 11
Name ......................................................................................................................................................... 12
IP Address ................................................................................................................................................. 12
Port ........................................................................................................................................................... 13
API User.................................................................................................................................................... 13
Customer ................................................................................................................................................... 13
Pgina 1 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Profiles ...................................................................................................................................................... 13
Sequential .................................................................................................................................................. 14
Next ........................................................................................................................................................... 14
License ...................................................................................................................................................... 15
Name ......................................................................................................................................................... 15
Content ...................................................................................................................................................... 15
Name ......................................................................................................................................................... 17
Type ........................................................................................................................................................... 17
Ticket ......................................................................................................................................................... 18
PRINTING TICKETS...................................................................................................................................... 20
ROUTER .......................................................................................................................................................... 20
PROFILE .......................................................................................................................................................... 20
PRINTER.......................................................................................................................................................... 20
Pgina 2 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
TICKET ........................................................................................................................................................... 21
USERNAME ..................................................................................................................................................... 21
PRINT.............................................................................................................................................................. 21
ENTITIES ......................................................................................................................................................... 23
Router ........................................................................................................................................................ 23
Ticket ......................................................................................................................................................... 24
Printer ....................................................................................................................................................... 24
UserLog ..................................................................................................................................................... 24
URL ........................................................................................................................................................... 25
Methods ..................................................................................................................................................... 25
Examples ................................................................................................................................................... 26
URL ........................................................................................................................................................... 27
Methods ..................................................................................................................................................... 27
Examples ................................................................................................................................................... 28
URL ........................................................................................................................................................... 28
Pgina 3 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Parameters ................................................................................................................................................ 28
Examples: .................................................................................................................................................. 29
URL ........................................................................................................................................................... 30
Parameters ................................................................................................................................................ 30
Examples: .................................................................................................................................................. 30
URL ........................................................................................................................................................... 31
Parameters ................................................................................................................................................ 31
Examples: .................................................................................................................................................. 31
CHANGELOG .................................................................................................................................................. 34
Pgina 4 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Introduction
Infinitel HotSpotWeb for Mikrotik is an application with a web interface to generate customized
printed tickets with randomly generated or predefined usernames and passwords for one or more Mikrotik
User Manager based HotSpots. HotSpotWeb also provides a RESTful API to provide third party systems
integration to manage the application settings, generate users, print tickets and perform any RouterOS API
command against the registered devices through HTTP/JSON.
HotSpotWeb connects to the registered Mikrotik User Manager throught RouterOS API devices and
prints to a thermal ESC/POS printer either local or with network support (wifi or ethernet) to generate paper
tickets.
Infinitel HotSpotWeb supports as many Mikrotik User Manager profiles as you need. You can set
your Mikrotik User Manager to set tickets duration in minutes, hours, days or weeks and print them with a
single touch.
o Format your text font: bold, underlined, double tall, double wide.
Pgina 5 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Requirements
The host system must have network access to the device RouterOS API service.
Printers must be locally installed in the host where the app is running or must have network visibility
from the host in case of network printers.
Pgina 6 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Installation
First step
Microsoft Windows
Once uncompressed, you must install the app as a Windows service. From a command line interface
move to the installation folder and type:
HotSpotWeb.exe /install
HotSpotWeb.exe /start
Once the service is installed you can control the service state from the Services window on the
Windows Administrative Tools.
Uninstall service
HotSpotWeb.exe /stop
HotSpotWeb.exe /uninstall
Other OS
To run the app on any Java 1.7+ enabled OS you should check that the java executable is on path
and use the following command to run the app:
Follow your OS indications to install a java process as a daemon if you want the app to autostart
when the system boots.
Pgina 7 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Application.properties file
#Backup Schedule
backup.cron=0 0 6 * * ?
#Config password
config.password=
Options
Pgina 8 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
backup.cron: Set non-blocking backup schedule in Quartz cron expression format. The backup will
only work if the embedded hsql database is used, if another dbms is used you will have to use its own
backup procedures. By default, if not set, the backup will be performed daily at 06:00 AM. The backup file
can be found at .\backup\backup.tgz.
config.password: You can password protect the app configuration pages (Routers, Printers and
Tickets) setting this value to the desired password, leave it blank to skip the password protection.
Setup database
By default the app uses an embedded HSQLDB to store the data but can be switched to any other
SQL database with a JDBC driver supported by the HIBERNATE framework. In the default
application.properties file theres a commented example to setup a MySQL database.
Only the HSQLDB JDBC driver is included. If you want to use another database you must download
the corresponding JDBC driver and place it in the <installation path>/lib directory before starting the
application.
Only one datasource can be used at once, so if you switch to another database please comment or
delete any other sprint.datasource.* entry.
Usually, on most dbms, youll have to create the database first. The application will create all needed
tables on the first connection to a new database.
First use
Once installed and configured you can access the application using the url:
http://<ipaddress_or_hostname>:<port>
If you use the default settings and you open the web browser in the same computer where you
installed the app just type:
http://localhost:8080
Pgina 9 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Pgina 10 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Settings
Routers
Printers
Tickets
Routers Management
When editing or adding a router you will have the following fields to setup:
Pgina 11 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Name
Name is a unique identifier for a Mikrotik User Manager device. It will be shown in selection lists
when printing tickets.
IP Address
We must set the IP address or dns entry of the Mikrotik device running Mikrotik User Manager.
Pgina 12 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Port
The TCP port used to connect to the API service. By default 8728.
API User
Username with enough permissions to access the Mikrotik device through API service, read settings
and write new User Manager users. In our example
API Password
Customer
This parameter makes reference to the customer/subscriber (depending on User Managers version)
that owns the profiles/credits that the application uses. Specifically, the owner of the profiles (in 5.x) or
credits (in 4.17) and the owner of the newly created users that will get printed tickets.
Newly created user will get an username like [prefix][random string]. It can be left blank.
This parameter specifies the length of the random string generated to compose the new usernames.
It is recommended to use a string length greater than or equal to 4.
This parameter will set the default length for the newly generated users password which will always
be a random string of the specified length.
Profiles
The profiles parameter refers to profile elements in Mikrotik 5.12 or higher, or credit elements in
version 4.17. On the printed ticket the tag ${profile} will be replaced by:
On version 4.17: The credits comment value will be used. If the value of comment is empty
the name of the profile will be used instead.
Pgina 13 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
On version 5.12 or higher: The profiles field name-for-users will be used. If not set, the
name of the profile will be used instead.
Once name, ip address, port, API user, API password and customer are set you can use the Load
Profiles button to preload the existing profiles in User Manager.
Sequential
When Sequential is enabled, usernames will be created sequentially building the username as
[prefix]+[next number]. The username number will be taken from Next Number for Username and will be
formatted as a zero filled string based on the value of Username Length. As an example, having a
Username Length of 4 and a Prefix as Pre_ new generated users will be in the range of Pre_0001 and
Pre_9999. Once, in this example, the 9999 value is reached count will restart at 1.
Next
Fixed Password
If Fixed Password is checked, the generated password will be always equal to the generated
username. Useful to setup single field login (instead of user/password login) captive portal.
List of predefined and reusable usernames. Those will be available from the print page.
This function can be easily explained through an example. Suppose we have a small hotel with 10
rooms. We want to assign a username to each room and change the password each time a new guest
checks in. We should create a username list like this:
Room01
Room02
Room03
Room10
Pgina 14 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
If we choose a predefined username, Room03 as an example, and we push the print button, lets
say 1week. Within this example we will get a ticket with Room03 as username, for 1 week and with a
random password. If user Room03 already exists in User Manager, it will be deleted and replaced with a
newly created user.
License
Name
Content
The ticket is a field to set the full content of the ticket that will be send to the printer when creating an
user.
Pgina 15 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
[C][LOGO]
[B][U]HotSpot Infinitel
[L][b][u]
[B]Acceso: [b]${profile}
[B]Nombre: [b]${user}
[B]Clave: [b]${pass}
[R][W][T]Thank you
[CUT]
To set the format of the ticket we can use the following tags:
Pgina 16 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
[LOGO] Print the bitmap set to the position 1 of NV memory in the ESC/POS printer
Printers Management
Name
Type
A network printer needs network visibility from the host where the app is installed.
Pgina 17 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
A local printer can be chosen from the installed printers in the installation host.
Network printer
Address
Port
Local Printer
The dropdown list show all printers installed on the host machine.
Ticket
Choose the default ticket format for this printer. If no ticket is chosen the ticket will output through the
default printer selected here.
Pgina 18 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Pgina 19 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Printing Tickets
The Print page allows you to generate users and print tickets selecting the different options available:
Router
If more than one Mikrotik device has been setup you can choose where to generate the user. If only
a single Mikrotik device has been setup this column will be hidden.
Profile
Shows the available profiles in the selected router. Once again if only one profile is available the
column will be hidden, so no need to choose a profile.
Printer
Lists the available printers. Choose one to set the printer where the ticket is printed. If only one
printer is available the column will remain hidden.
Pgina 20 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Ticket
Lists the available ticket formats. If none is chosen, the default ticket format for the selected printer
will be used. If only one ticket format is defined the column will remain hidden.
Username
You can enter a custom username on the textfield and it will be used when printing the next ticket. If
the router has a predefined list of usernames it will be shown below the textfield as a list. If you choose an
entry from the list it will be used as username.
If left blank or have not choose a predefined user, the routers settings will apply.
If a user with the same username already exists on the router, it will be erased and created again
with the selected profile.
When printing, the app will connect to the User Manager, generate a user with the selected options
and print a ticket thought the selected printer. If the process completes successfully the new username and
password will be shown below. If something fails, the app will show below the failure reason.
Pgina 21 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Api access
To access the root resource for the RESTful API you can use:
http://<ipaddress or hostname>:8080/api
{
"_links" : {
"printers" : {
"href" : "http://localhost:8080/api/printers{?page,size,sort}",
"templated" : true
},
"userLogs" : {
"href" : "http://localhost:8080/api/userLogs{?page,size,sort}",
"templated" : true
},
"routers" : {
"href" : "http://localhost:8080/api/routers{?page,size,sort}",
"templated" : true
},
"tickets" : {
"href" : "http://localhost:8080/api/tickets{?page,size,sort}",
"templated" : true
},
"profile" : {
"href" : "http://localhost:8080/api/alps"
}
}
}
Pgina 22 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Settings management
The settings management API provides access to the different entities through RESTful/JSON using
the HATEOAS standard. For each entity type you can list/view (GET), create (POST), modify (PUT, PATCH)
or delete (DELETE) instances through http.
Entities
Router
Fields
customer: User Manager customer for new users and profile search. Required.
Pgina 23 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Ticket
Fields
content: Content of the ticket. Refer to the ticket format specified on the current manual. Required.
Printer
Fields
address: Required.
port: Set the TCP port for a network printer. Defaults to 9100. Optional.
UserLog
Fields
Pgina 24 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Search query
Returns all log entries from a start date (yyyy-mm-dd 00:00:00) until end date (yyyy-mm-dd
00:00:00). Optionally, the result can be paginated.
http://<ipaddress_or_hostname>:8080/api/userLogs/search/findByCreatedGreaterThan
EqualAndCreatedLessThan{?start,end,page,size,sort}
http://<ipaddress_or_hostname>:8080/api/userLogs/search/findByCreatedGreaterThan
EqualAndCreatedLessThan?start=2015-01-01&end=2015-02-01
URL
http://<ipaddress or hostname>:8080/api/<entity>
Methods
Pgina 25 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
List parameters
sort
http://<ipaddress or hostname>:8080/api/<entity>?sort=<field,[desc]>
Use sort to order the results by the selected field. By default the order applied is ascending. If you
want descending order you should append ,desc.
page
http://<ipaddress or hostname>:8080/api/<entity>?page=<int>
Use page to select list viewed page, by default page size is 20 and the default page is 0, which is the
first one.
size
http://<ipaddress or hostname>:8080/api/<entity>?size=<int>
Examples
http://localhost:8080/api/routers?sort=name
http://localhost:8080/api/routers?sort=name,desc
http://localhost:8080/api/routers?page=1
http://localhost:8080/api/routers?size=50
Pgina 26 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
http://localhost:8080/api/routers?page=3&size=30&sort=address,desc
{
"name" : "Printer 1",
"type" : "NETWORK",
"address" : "192.168.1.20",
"port" : 9100,
"ticket" : "http://localhost:8080/api/tickets/1"
}
URL
http://<ipaddress or hostname>:8080/api/<entity>/<id>
Methods
PUT: Modify entity. All fields must be included. Any excluded field defaults to NULL.
Pgina 27 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Examples
http://localhost:8080/api/routers/6
{
"address" : "192.168.1.21"
}
Print command
Generates a new user and prints a voucher/ticket through the selected printer.
URL
http://<ipaddress or hostname>:8080/api/print
Parameters
profile: User Manager profile to assign to the new user. Optional if only one profile is available on the
target router.
Pgina 28 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
ticket: Ticket ID. Optional. Use this parameter to override the default ticket format associated with the
printer.
username: Fixed username. Optional. The new user will be created with the specified username. If
the username already exists it will refresh the password and assign the selected profile.
JSON Response
{
"ok":false/true ,
"message":"Error message"/null,
"username":user/null,
"password":password/null
}
ok: true if request has been processed correctly, false if something failed.
message: Reports the error message is something fails, otherwise returns null.
Examples:
Generate a new random user with the default router, profile and print through the default printer
http://localhost:8080/api/print
http://localhost:8080/api/print?router=2&profile=1day&printer=3
Generate user named user, through default router and default printer, with ticket format 5 with 1hour profile.
http://localhost:8080/api/print/?ticket=5&profile=1hour&username=user
Pgina 29 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Profiles command
URL
http://<ipaddress or hostname>:8080/api/profiles
Parameters
JSON Response
{
"profiles":["profile1","profile2",,profileN]/null,
"ok":false/true ,
"message":"Error message"/null
}
ok: true if request has been processed correctly, false if something failed.
message: Reports the error message is something fails, otherwise returns null.
Examples:
http://localhost:8080/api/profiles?router=1
Response:
{
"profiles":["default","1day"],
"ok":true,
"message":null
}
Pgina 30 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Run command
Run command allows to execute any available command on the router through the RouterOS API
service. For detailed information about the RouterOS API service command format please consult the
Mikrotik RouterOS documentation.
URL
http://<ipaddress or hostname>:8080/api/run
Parameters
command: The command to execute on the router. Use the | (vertical bar) to indicate a carriage
return.
JSON Response
{
"ok":false/true ,
"message":"Error message"/null,
result:[{key1:value1,,keyN:valueN},{}]
}
ok: true if request has been processed correctly, false if something failed.
message: Reports the error message is something fails, otherwise returns null.
result: If the command responds with any output it will be returned as an array of key/value lists.
Examples:
http://localhost:8080/api/run?router=1&command=/ip/route/print|?dst-address=0.0.0.0/0
Response:
{
"ok":true,
"message":null,
Pgina 31 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
"result":[
{
"!re":null,
".id":"*30000001",
"dst-address":"0.0.0.0/0",
"gateway":"172.17.1.254",
"gateway-status":"172.17.1.254 reachable via e10wan",
"distance":"0",
"scope":"30",
"target-scope":"10",
"vrf-interface":"e10wan",
"active":"true",
"dynamic":"true",
"static":"true",
"disabled":"false"
}
]
}
Reboot router id 3
http://localhost:8080/api/run?router=3&command=/system/reboot
Response:
{
"ok":true,
"message":null,
"result":[]
}
Show fields bridge and interface of all bridge ports on default router:
http://localhost:8080/api/run?command=/interface/bridge/port/print|=.proplist=bridge,interface
Pgina 32 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Response:
{
"ok":true,
"message":null,
"result":[
{
"!re":null,
"bridge":"bridge1",
"interface":"ether1"
},{
"!re":null,
"bridge":"bridge1",
"interface":"ether2"
},{
"!re":null,
"bridge":"bridge1",
"interface":"ether3"
}
]
}
Pgina 33 de 34
Avda. Ricardo Curtoys Gotarredona, 4 Local 4 - 07840 Santa Eulalia del Ro
Telfono 971 338 111 - Fax 971 338 712
email: info@infinitel.es - web: www.infinitel.es
Changelog
Version 1.0
Initial Release
Version 1.2
Version 1.3
Version 1.4
Now the app footer can be customized editing the .\static\footer.html file
Version 1.5
Pgina 34 de 34