Updating an Analytics API Key > Update a ThingWorx Analytics API Key – Windows
Update a ThingWorx Analytics API Key – Windows
Generate a New API Key
1. On the Windows computer where your ThingWorx Analytics is installed, open the Windows PowerShell, or a Command Prompt, in Administrator mode and navigate to the properties file at the following path:
C:\Program Files (x86)\ThingWorxAnalytics\Thingworx_Analytics_Server\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:
Keystore folders
3. Navigate to the directory where your ThingWorx Analytics is installed:
C:\Program Files (x86)\ThingWorxAnalytics\Thingworx_Analytics_Server
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 C:\Program Files (x86)\ThingWorxAnalytics\Thingworx_Analytics_Server\988f188b C:\Program Files (x86)\ThingWorxAnalytics\Thingworx_Analytics_Server\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.bat 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.ps1 restart
It might take several seconds for the Things in ThingWorx to refresh and reconnect.
Was this helpful?