Step 1 - Enable REST API
By default, a SNAP PAC has SSL enabled and the web server for the REST API is disabled. To use the REST API, you need to configure the port on which it will listen.
The are two options for connecting to the REST API:
Protocol | Standard Port | Description |
---|---|---|
HTTPS | 443 | Uses standard SSL encryption to secure the communication between the client software and the PAC. This is the default and recommended setting. |
HTTP | 80 | Insecure access to the REST API. |
Using PAC Manager’s Inspect tool:
- Click Communications, and choose Network Security from the pop-up menu.
- In the WEB SERVER section:
- Change the default value of TCP Listen Port. Typically, port 443 is used for HTTPS, and port 80 is used for HTTP.
- Verify the value of HTTPS.
- For HTTPS, the value should be Enabled.
- For HTTP, change the value to Disabled.
- Click Apply to save the changes.
- Click Status Write, and then, in the Operation area:
- Click “Store configuration to flash”, and then click Send Command.
- Click “Restart Device from powerup”, and then click Send Command.
Step 2 - PAC Username and Password
Open a web browser and navigate to your PAC’s Authentication Key Management web page.
Use https://<controller IP address>/admin/creds, replacing the IP address with that of your controller. Change the address scheme to http if that’s what you’ve configured the PAC to use. You should see a screen like this:
Log in with the default user name and password, which are admin and password.
You must set a new user name and password. If you don’t, the controller will not allow the REST API to be used.
Enter a new user name and a new password, and then click Submit.
Step 3 - Install Security Certificates
If using HTTPS, you will need to purchase or generate security certificates and install them in the controller.
Since this alone is a large topic, please see the following sections:
Return to this section when done.
Step 4 - Configure API Keys
Open a web browser and navigate to your PAC’s Authentication Key Management web page.
Use https://<controller IP address>/admin/keys, replacing the IP address with that of your controller. Change the address scheme to http if that’s what you’ve configured the PAC to use. You should see a page like this:
API keys are similar to user accounts and passwords. Since they’re intended to be used by software and machines, they’re called Key IDs and Values, rather than user name and password.
You must create at least one API key. Treat the information secret, just like you would for any other account. You can enter anything you want. The Key ID can be descriptive of how that particular key will be used.
For example, here’s a Key ID and Value for use with Node-RED.
When done, click Submit. The PAC Control REST API is now ready to be used.
Next Step
Continue to installing Node-RED.