Installing the API service

Installing the API service

The following should only be performed by IT administrators.

The PREMIER API needs to be installed (extracted) on the server disk, where the PREMIER program is also stored locally.

We will send you the file needed for installation after ordering this service. After downloading the ZIP file, please extract the contents directly to the local disk C:\ In the ZIP file, there is a directory www_api, which will be created on the disk, for example, C:\www_api

First, it is necessary to set the required unit, which is already in the SQL data, for accessing the API. After opening the www_api directory, we find the file "ApiComPremForm.exe", and the main dialog for settings will appear.

Requirements

  • SQL version of the Premier, at least in version MS SQL 2016 (also applies to the Express edition)

  • The "Compatibility level" option in SQL administration must be set to at least "SQL Server 2016 (130)", otherwise not all commands may execute correctly:



Basic Settings

At the top, we set the port on which the web service will listen. The default path to HTML is the path to the www_api directory. It is possible to choose HTTP or HTTPS communication. For HTTPS communication, it is necessary to establish a certificate for the given domain, which will then be set in the dialog below. At the bottom, an accounting unit can be added, which will be connected to the API. You can add a unit by clicking the button with the PLUS symbol.

001661-51-51-20250701-195147.jpg

The first path is the directory \premier\ - directly to the root folder, where "premier.exe" is located. After entering the path, we click the "R" button, which loads a list of all accounting units, from which we then select the desired unit. After selection, the name of the SQL server and the type of authorization will be displayed below. This information is read-only. At this stage, it is advisable to verify the connection to the SQL server - "Test connection". If the connection is fine, we can generate what is called ID_UJ (ID of the accounting unit), which should not be changed after saving. In case of changes, you must inform the developers who are handling this communication with your software.

“Asynchronous communication” default - unchecked.
When communicating, a channel is created between the server and the client. If multiple requests for multiple companies are sent within the channel, we do not recommend enabling it!

“Asynchronous communication” - checked.
Enable this option if the third-party software ensures that it will always wait for a response from the server and simultaneously needs to connect to the API from multiple clients (different IPs). Several commands will be executed concurrently, making communication faster. This is suitable for new HTML features such as loading documents from links in emails and similar.

The last field is www_path, which is again the directory C:\www_api\. Then we just save the dialog and return to the main window, where on the first line the "Unit name and its number" is displayed. After clicking Save in the main window, the automatic registration of DLL libraries on the SQL server will begin. In order to register these libraries on the SQL server side and create the necessary CLR procedures on the SQL server side, the account set in IS PREMIER must be a sysadmin account. This is needed just for this setup and installation. Without a sysadmin account, it is not possible to proceed further, and CLR procedures will not be created. If the procedures are created, a small dialog will appear on the screen indicating that the function registration is in progress.

If everything is in order, we can save everything and close the dialog.

Service Installation

The next step is to install and configure the service in Windows.

We open the command prompt "as administrator", switch to the directory C:\www_api and enter the command:

apicompremservice -install

001662-52-52-20250701-195226.jpg

  

A similar procedure is also used for uninstalling the service, just with the parameter -uninstall.

After installing the service, we open "Services" in Windows and change the account under which the service will run. It is necessary to set an account from the Administrators group that also has sysadmin rights on the SQL server.

After the change, it is necessary to restart the service.

API Service Update

It is also advisable to update the service itself. This can be done by running the file (as an administrator) C:\www_api\ApiComUpdate.exe. A dialog will appear where the modules needed for the update will be automatically selected. You just need to click the "Update" button.. 

Everything will then be done automatically. After the update, it is necessary to restart the ApiComPrem service.

When performing the API update, it is necessary for the service account in Windows and the account used to authenticate PREMIER in the unit settings to be set as "sysadmin" on the SQL server.

Web Interface

If everything is up to date, the service is running, we can launch a browser on the local PC and test basic communication.

In the browser, we enter: http://IP_SERVER:PORT e.g. http://192.168.0.38:19901 - if we did not use a certificate for SSL, otherwise the entry will be https://..... The web interface of the service will be displayed.

We can fill in the required information and enter JSON for output, e.g.

{   "select": "select top 10 * from partnery" } nebo { "command": { "inComm": "VERZEAPI" } }

The result should be an output in the right part of the text box displaying the partners entered in the accounting unit.

 

If you are preparing the installation for your developers, you need to provide them with the following information: