API server(aka Java API) allows to retrieve data or change system settings via POST and GET requests in within user’s restrictions.
API provides and sends all data in JSON over HTTP. Both of web interface (panel and ui), SMS server, tracker server uses it.
Installing API server under Windows
- Move directory api-server from the distributed directory, for example to c:\api-server
- To install the application as service, run installService.bat with administrative rights
- Now you can manage the server using startService.bat and stopService.bat. There are another way using standard system tool of service management. Also with the help of trayIcon.cmd an icon in system tray will be appeared and it will showing status of the application and permit to manage it.
- If necessary to remove the service or to move the application to another directory, it can be removed using uninstallService.bat
API server installation under Unix
To install service under Unix do steps in instructions on page
API server configuration
- Open file /home/java/api-server/conf/config.properties using text editor
- Edit MySQL connection parameters (in angle brackets it is specified which values to change, angular brackets don’t need to be written):
# database db.connectionString=jdbc:mysql://<IP or server name where MySQL works>:3306/google db.username=api-user db.password=<user password api-user that has been generated on step deploying databases>
In google database update the field link_monitoring and insert there your real domain. You can do it with query
mysql> update dealers set link_monitoring='ui.domain.com'
- (optional) Specify tcp settings :
# server api.hostname=<network interface where Java API will listen for connections (default: 0.0.0.0)> api.port=<port that wil be used for connections (default: 8084)>
- Edit addresses settings:
defaultDealer=<dealer’s ID(default value is 1, it is required to change to another values in special cases only)> defaultDealerDomain=<the domain where monitoring interface is available (e.g. ui.domain.com)>
- Edit mail settings:
# mail mail.user = <smtp username> mail.password = <user password> mail.smtp.host = <smtp server address> mail.smtp.port = <smtp port> mail.smtp.useAuth = true mail.smtp.useSsl = true
If you want to send emails from localhost as MTA you should specify the following settings:
mail.user = mail.password = mail.smtp.host = localhost mail.smtp.port = 25 mail.smtp.useAuth = false mail.smtp.useSsl = false
In that case the mail system has to be started on the server. Also we advise to create SPF for you domain with list of allowed to send ip addresses and to create DKIM, in this case messages will not be marked as spam. The IP address of the server should has got reverse DNS record(also known as PTR). Then write parameters that will be substituted in the ‘From’ field:
#feedback parameters feedback.toEmailemail@example.com feedback.defaultFromEmailfirstname.lastname@example.org
Further edit the string(only for providers)
You should put ‘true’ here if you’d like to send registration mails (correspondingly, the user interface should support registration, it’s written in web interface settings).
- In /home/java/api-server directory you should create a subdirectory named by “static” if it does not exist.
mkdir -p /home/java/api-server/static
- P.S. If you would like to send emails by only one server you can add the following string to api server config:
- Comment a single string in
After settings have been changed you should restart the api server.