# CREATING A THINGWORX CONNECTION
This setup is intended to be a minimal setup example to get the ThingWorx connector working. The ThingWorx IoT connector requires that the ThingWorx Platform is installed and configured upfront.
# Creating a Connection
WebSocket Secure (WSS) over TLS v1.2 connection is the recommended protocol by ThingWorx and is mandatory. You need to create the connection prior to creating the flow. The creation of a connection establishes a link from ThingPark Wireless to the cloud provider that you want to associate a Device with. The link can be used to transport any Uplink regardless the DevEUI parameter. To do this, you need to use the following endpoints:
POST/connections
for creationPUT/connections
for modificationDELETE/connections
for deletion
Note
When you update a configuration property on a connection, you must provide the whole configuration properties again.
Example of the creation of a connection
POST /connections
{
"connectorId": "actility-thingworx-iot",
"name": "Test ThingWorx Connection",
"configuration":
{
"description": "ThingWorx Datacenter",
"hostName": "127.0.0.1:8443",
"applicationKey": "0d820ccd-9623-4f6d-9b45-3f6c0cf06ecd",
"thingTemplateName": "actilityThingTemplateSF"
}
}
The following table lists the expected results of properties when applied.
Property | Expected results |
---|---|
connectorId | Set to actility-thingworx-iot |
configuration/hostName | Defines the host:port of the ThingWorx Platform to use. Note Ensure that platform has SSL/TLS enabled |
configuration/applicationKey | Secret access key for accessing the ThingWorx Platform. Required for building the WSS over TLS v1.2 connection. |
configuration/thingTemplateName | ThingWorx ThingTemplate to be associated with the Things processed by the connector. |
# Collecting Expected Information on ThingWorx
# Setup
This setup is intended to be a minimal setup example to get the ThingWorx connector working.
# Prerequisites
The ThingWorx connector is intended to be connected to the ThingWorx Foundation service. This service can be either provided by ThingWorx as a SaaS service or hosted on local premises.
# Configuration
After enabling the ThingWorx service, an application key must be retrieved, and Actility Thing Templates must be imported.
# Application key retrieval
We recommend that you create a new user or use an existing one that is different from the Administrator user.
- Login to ThingWorx Composer as Administrator
(https://<host>:<port>/Thingworx/Composer/index.html)
and click the Users' link in the 'Security' section of the menu. Click New to add a new user.
On the ‘General Information’ tab fill username, password and make sure ‘Enabled’ is checked and click Save.
Click the 'Application Keys' link in the 'Security' section of the menu and click New to create an application key for the newly created user.
Set key ‘Name’, select ‘Username Reference’ and set an ‘Expiration Date’ in the future. and then click Save.
5. After you click Save, a ‘Key ID’ is generated. Copy it to use it in Actility Flow Connection configuration.
# Permissions setup
- Click on the ‘Collections’ link in the ‘Permissions’ section of the menu, select ‘Things’ and ‘Thing Templates’ and click Edit Permissions.
- On the ‘Visibility’ Tab, select ‘Composer’ organization and click Save.
- On the ‘Design Time’ tab, select the user and check at least ‘Create’ and ‘Read’ permission and click Save.
- Click on the ‘Entities’ link in the ‘Permissions’ section of the menu, search/select ‘EntityServices’ and click Edit Permissions.
5. On the ‘Visibility’ Tab select ‘Composer’ organization and click Save.
- On the ‘Run Time’ tab add ‘CreateThing’, ‘CreateThingTemplate’ and ‘GetEntityList’ services and allow the created user to execute them and click Save. In this way the Actility Connection that will use the application key will be able to create initial ThingTemplate (if it is missing) and to create Things (if they are missing) on the ThingWorx Platform.
- In the ‘Access Reports’ link in the ‘Permissions’ section of the menu you can check that the user has access to those services.
- Now you can login with the newly created user in the ThingWorx Composer and use the application key (Key ID) inside the Actility Connection configuration.
# Displaying Information to Know if it Worked
Go to the ThingWorx Composer dashboard and select the Device you want to monitor.
Click “more” to see the latest uplink data: