Updating an Analytics API Key
Update a ThingWorx Analytics API Key – Linux
For ThingWorx Analytics 8.5.0 and Later
When you need to update the ThingWorx Analytics API Key, follow the procedures below to generate a new key and, if necessary, encrypt it. The API key facilitates communication with internal ThingWorx Analytics microservice APIs and is only applicable for release 8.5.0 and later. If you are using an earlier version of ThingWorx Analytics, these procedures are not necessary.
Generate a New API Key
1. In the installation directory where your ThingWorx Analytics is installed, open a terminal window as the root user and navigate to the properties file at the following path:
/opt/ThingWorxAnalytics/ThingWorxAnalyticsServer/config/system—environment-variables.properties
2. In the #keyStore section, make note of the following alphanumeric folder names that are randomly assigned during ThingWorx Analytics installation:
◦ key.store.directory
◦ key.store.password.directory
◦ key.store.password.file
◦ key.store.file
Example folder names:
3. Navigate to the directory where your ThingWorx Analytics is installed:
/opt/ThingWorxAnalytics/ThingWorxAnalyticsServer
4. Run the following command to generate a new ThingWorx Analytics API key. Replace the angle brackets with the randomly assigned alphanumeric folder names:
java -jar css-security-bin.jar <key.store.password.directory> <key.store.directory> <key.store.password.file> <key.store.file>
Example command:
java -jar css-security-bin.jar /opt/ThingWorxAnalytics/ThingWorxAnalyticsServer/988f188b /opt/ThingWorxAnalytics/ThingWorxAnalyticsServer/d18429a3 2e3bb250 cd0e1544
| When the new API key is displayed on screen, make a note of it. You will need it for the next procedure to encrypt the key. If you are accessing ThingWorx Analytics functionality via an integration with ThingWorx, the next procedure is required to encrypt the key for the ThingWorx Adapter. If you are accessing the ThingWorx Analytics functionality through FactoryTalk Analytics DataFlowML, you do not need the next procedure but you will need this key to configure your custom processors. |
Encrypt the New API Key
1. From the directory where your ThingWorx Analytics is installed, execute the following command to run a script that will update the encryption of your new Analytics API key:
./update-encrypted-password.sh a <new_analytics_api_key>
In the angle brackets, supply the new API Key you generated in the previous procedure.
A message is displayed when the encryption process is complete and the command prompt returns.
2. From the bin folder of the installation directory, use the following command to restart the services:
./twas.sh restart
It might take several seconds for the Things in ThingWorx to refresh and reconnect.