Skip to main content

Connection

Note

It is not recommanded to create a connection instance using API for ThingPark Entreprise users.

Retrieve list of connections available

Connection details, startup time and status can be retrieved using GET /connections as shown below.

GET /connections

[
{
"configuration": {
"protocol": "SSL",
"region": "eu-central-1",
"accountPrefix": "a2e8k469sk385s-ats",
"accessKeyId": "*****",
"secretAccessKey": "*****",
"certificateId": "arn:aws:iot:eu-central-1:076081621542:cert/28e7cc38a99f78b3d0b2b1af5d4cd8ddc83264ad435ce4248f4146ccc34e3329",
"privateKey": "*****",
"deviceType": "actilityDeviceType",
"uplinkTopicPattern": "tpx/things/{DevEUI}/uplink",
"downlinkTopicPattern": "tpx/things/{DevEUI}/downlink",
"description": "Test AWS Connection configuration",
"createDevices": true,
"sendMetadata": false,
"sendRawDecodedFormat": false,
"certificate": "*****"
},
"id": "8",
"connectorId": "actility-aws-iot",
"name": "Test AWS Connection",
"active": true,
"startupTime": "2019-09-27T10:08:08.309+02:00",
"state": "OPENED"
},
]

Create a new connection

  1. Retrieve the connector ID for the type of connection required, using the /connectors endpoint.

GET /connectors
[
{
"id": "actility-aws-iot",
"producerId": "actility",
"moduleId": "aws-iot",
"version": "2.0.0",
"description": "Actility AWS IoT Connector",
"logo": null,
"beta": null,
"urlDoc": null,
"connection": {
"configurationSchema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Aws Connection Config",
"type": "object",
"additionalProperties": false,
"properties": {
"description": {
"type": "string"
},
"createDevices": {
"type": "boolean",
"default": true
},
"sendMetadata": {
"type": "boolean",
"default": false
},
"sendRawDecodedFormat": {
"type": "boolean",
"default": false
},
"uplinkTimeValidity": {
"type": "string"
},
"uplinkRateLimiter": {
"type": "integer"
},
"downlinkEnabled": {
"type": "boolean",
"default": true
},
"downlinkAsId": {
"type": "string"
},
"downlinkUuid": {
"type": "string"
},
"downlinkAsKey": {
"type": "string"
},
"downlinkPort": {
"type": "string"
},
"reconnectStrategy": {
"type": "string",
"default": "NORMAL",
"enum": [
"CALM",
"NORMAL",
"AGGRESSIVE"
],
"description": "CALM, NORMAL or AGGRESSIVE"
},
"chainedWithConnectionIds": {
"type": "array",
"items": {
"type": "integer"
}
},
"protocol": {
"type": "string",
"default": "SSL",
"enum": [
"TCP",
"SSL",
"WSS"
],
"description": "SSL or WSS"
},
"connectionTimeout": {
"type": "integer"
},
"actionTimeout": {
"type": "integer"
},
"region": {
"type": "string"
},
"accountPrefix": {
"type": "string"
},
"accessKeyId": {
"type": "string"
},
"secretAccessKey": {
"type": "string"
},
"certificateId": {
"type": "string"
},
"certificate": {
"type": "string"
},
"privateKey": {
"type": "string"
},
"deviceType": {
"type": "string"
},
"createDeviceTypes": {
"type": "boolean",
"default": true
},
"uplinkTopicPattern": {
"type": "string"
},
"downlinkTopicPattern": {
"type": "string"
},
"topics": {
"type": "array",
"items": {
"$ref": "#/definitions/ConnectionTopic"
}
},
"proxy": {
"$ref": "#/definitions/ProxyConfig"
}
},
"required": [
"region",
"accountPrefix",
"accessKeyId",
"secretAccessKey",
"deviceType",
"uplinkTopicPattern",
"downlinkTopicPattern"
],
"definitions": {
"ConnectionTopic": {
"type": "object",
"additionalProperties": false,
"properties": {
"fPort": {
"type": "integer"
},
"uplinkTopicPattern": {
"type": "string"
},
"downlinkTopicPattern": {
"type": "string"
}
}
},
"ProxyConfig": {
"type": "object",
"additionalProperties": false,
"properties": {
"hostname": {
"type": "string"
},
"username": {
"type": "string"
},
"password": {
"type": "string"
}
}
}
}
}
},
"flow": {}
}

  1. Create the connection using the /connections endpoint as shown below:
POST /connections

{
"connectorId": "actility-aws-iot",
"name": "Test AWS Connection",
"active": true,
"alarms": [
{
"startTime": "2019-01-31T09:00:00+01:00",
"endTime": "2019-01-31T18:00:00+01:00",
"timezone": "Europe/Paris",
"recurrence": [
{
"frequency": "weekly",
"byDays": ["monday", "tuesday", "wednesday", "thursday", "friday"]
}
],
"uplinkRateMinPerHour": 10,
"message": "Low rate during business day..."
}
],
"configuration": {
"description": "AWS Europe Datacenter",
"createDevices": true,
"sendMetadata": false,
"sendRawDecodedFormat": true,
"uplinkTimeValidity": "5m",
"downlinkEnabled": false,
"downlinkAsId": "TWA_199983788.1972.AS",
"downlinkAsKey": "9311e33d7d44fc52215b0dc789aa1d22",
"downlinkPort": 5,
"uplinkTopicPattern": "tpx/things/{DevEUI}/uplink",
"downlinkTopicPattern": "tpx/things/{DevEUI}/downlink",
"deviceType": "actilitytestsensor",
"region": "eu-central-1",
"accountPrefix": "a2sheeefctigr-ats",
"secretAccessKey": "lymHcfefddzerrZHnV5Q5YN/GTMFNiTREAj/7dz3358",
"accessKeyId": "AKIAJUJWTO76B3XZGHYA",
"certificateId": "arn:aws:iot:eu-central-1:101513775872:cert/8be79f58542e4f8983t45fgjb0842465efa41fea4554fa974",
"certificate": "-----BEGIN CERTIFICATE-----xxx-----END CERTIFICATE-----",
"privateKey": "-----BEGIN RSA PRIVATE KEY-----xxx-----END RSA PRIVATE KEY-----"
}
}
  • connectorId parameter is set to the value retrieved in the previous step.
  • To know more about connector specific parameters, please refer to the Connectors section of the online documentation.
  • Connection generic parameters are depicted below.