How To Install The Rest Api
The Collect! REST API allows you to connect to the core application and access functionality without
needed the User Interface.
At present there are 2 services that need to be installed and running. For connections that are
not on your server, the applicable ports will also need to be open on your firewall.
* API Server
* Authorization Server
Before beginning, look through your port list and determine which 2 ports will be used
for the services. For this document, port 4000 will refer to the authorization server
and port 4001 will refer to the API server.
Installation
When you are ready to install, contact Comtech Systems support to obtain a copy of the installer.
When you run the installer, select the option to install the API server and put in the path
to your Collect! folder (EX: C:\Collect).
The installation process will install any dependencies like Node.JS.
Authorization Server Configuration
The AUTH server is required for obtaining an access token that must be supplied with each API request.
It can also act as a proxy and load balancer sitting in front of the API server.
It is located in Collect\bin\companion\auth-server folder.
1. Navigate to the auth-server folder.
2. Rename the .env.example_ file to ".env."
Windows explorer does not allow you to create filenames that start with the period (.) character
but by appending a period to the end of the file name, Windows Explorer will remove it and allow
the first one, so ".env." will automatically be renamed to ".env"
3.Open the .env file and update the applicable fields. The below examples are the defaults and most
will not require changing.
SERVER_PROTOCOL = https
SERVER_HOST = 127.0.0.1
SERVER_PORT = 4000 # external port for auth server
# Update the below to match the location of your existing SSL certificates.
These must match the domain that you plan to connect to externally on the
above port number.
SERVER_CERT_PATH = C:\Collect\bin\webhost.crt
SERVER_KEY_PATH = C:\Collect\bin\webhost.rsa
# Update the below to match your settings. We recommend that you create a dedicated
user for this service in SSMS with read only access to the nx_ operator table.
DATABASE_NAME = cv_masterdb
DATABASE_USER = sa
DATABASE_PASS = secret
DATABASE_HOST = localhost # leave as localhost unless the SQL server is installed on another server
DATABASE_PORT = 1433
JWT_ACCESS_EXPIRY = 1800 # 30 minutes in seconds
JWT_REFRESH_EXPIRY = 604800 # 1 week in seconds
# YOU SHOULD CHANGE THESE SAMPLE SECRETS TO SOME RANDOM 32 DIGIT NUMBER
JWT_ACCESS_SECRET = 12345678901234567890123456789012
JWT_REFRESH_SECRET = 12345678901234567890123456789034
PROXY_COLLECT_API_URL = https://localhost:4001 # leave as localhost unless the API server is
installed on another server
PROXY_COLLECT_API_SECURE = false
4. Run the setup.bat file in the auth-server folder.
5. Open Command Prompt (Admin) and use cd commands to navigate to the auth-server folder.
6. Run the following command: pm2 start ./www/index.js --name authserver -i max
WARNING: If you make changes to the .env file, you will need to restart the pm2 service.
|
Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.
Please click this link to send us your comments: helpinfo@collect.org