In ArcGIS Velocity for Enterprise, an HTTP Poller feed may be configured with a URL that includes an API key. Because API keys can expire after a period of time, ranging from minutes to days, the key must be periodically regenerated. Rather than manually editing the Velocity feed each time the API key changes, you can automate the process by using the ArcGIS Velocity Admin API in a Python script to update the feed with the new key automatically.
The ArcGIS Velocity Admin API can be accessed by going to the following URL:
https://<Velocity Server Fully Qualified Domain Name>:7143/iot/api/swagger.html
This will provide a list of all supported operations and examples on how to use them.
Attached is a sample script on how to update a custom header or URL parameter for an HTTP Poller.
Notes
1. The ID of the input is required. This can be found in the URL of the feed:
2. Once you have the feed ID, update the # Variables section of the script.
Variables explained:
Variable | Description |
|---|
portalURL | Portal URL Velocity is federated with |
username | Portal Admin account |
password | Portal Admin password |
velocityURL | Velocity URL |
feedID | GUID of Velocity feed |
urlParameter | Boolean, set to True if updating a URL parameter; otherwise set to False |
urlParameterKey | Name of parameter key that will be updated; required if urlParameter is True |
customHeader | Boolean, set to True if updating a customer header; otherwise set to False |
headerKey | Name of header key that will be updated; required if customHeader is True |
3. The # Generate API tokenportion of code will vary depending on how you are generating the new token for the URL parameter key or custom header
4. Here is an example of an HTTP Poller that uses a custom header with the key x-verkada-auth and a token.
5. After the script is executed, you can see the token is updated successfully.
6. This script can be executed by Windows Task Scheduler on a given interval (i.e. once every x minutes/hours/days) to avoid any disruptions.