Skip to main content

API reference

OPC UA connector programming specifications

FairCom provides special API actions for OPC UA connectors and transforms. The OPC UA service must be enabled in order to complete FairCom OPC UA actions.

Examples

Note

The FairCom createInput JSON action is used to define the specifics of a connector device and the desired data.

{
  "authToken": "MyTokenHere",
  "api": "hub",
  "action": "createInput",
  "params": {
    "inputName": "opcDS1",
    "serviceName": "opcua",
    "settings": {
      "opcServerUrl": "opc.tcp://MyOPCDevice.com:4840",
      "opcDataCollectionIntervalMilliseconds": 5000,
      "propertyMapList": [
        {
          "propertyPath": "the_answer",
          "opcNamespace": 1,
          "opcNodeName": "the.answer"
        }
      ]
    },
    "tableName": "opcTable1"
  }
}
{
  "requestId": "19",
  "authToken": "MyTokenHere",
  "api": "hub",
  "apiVersion": "1.0",
  "action": "createInput",
  "params": {
    "inputName": "opcDS2",
    "serviceName": "opcua",
    "settings": {
      "opcServerUrl": "opc.tcp://MyOPCDevice.com:4840",
      "opcServerUser": "MyUser",
      "opcServerPassword": "MyPassword",
      "opcDataCollectionIntervalMilliseconds": 10000,
      "propertyMapList": [
        {
          "propertyPath": "temperature",
          "opcNamespace": 1,
          "opcNodeName": "OPC-temperature-datasource"
        },
        {
          "propertyPath": "humidity",
          "opcNamespace": 1,
          "opcNodeName": "OPC-humidity-datasource"
        },
        {
          "propertyPath": "pressure",
          "opcNamespace": 1,
          "opcNodeName": "OPC-pressure-datasource"
        },
        {
          "propertyPath": "quality",
          "opcNamespace": 1,
          "opcNodeName": "OPC-quality-datasource"
        }
      ]
    },
    "ownerName": "admin",
    "tableName": "opcTable2",
    "databaseName": "faircom",
    "retentionPolicy": "autoPurge",
    "retentionPeriod": 30,
    "retentionUnit": "day",
    "metadata": {
    }
  }
}

"params"

The "params" property is an object that contains an action's parameters. Each action defines its own required and optional properties.

Note

See createInput for "params" properties that are common to all connectors.

Table 1. OPC UA specific connector "params" properties summary

Property

Description

Default

Type

Limits (inclusive)

serviceName

specifies which type of input to create

Required - No default value

string

"opcua"

settings

specifies properties needed to configure the data source of the input

Required - No default value

array of objects

settings
.opcServerUrl

specifies the IP or URL to your OPC UA device, including the port

Required - No default value

string

settings
.opcServerUser

specifies the username for your OPC UA device

""

string

settings
.opcServerPassword

specifies the password for your OPC UA device

""

string

settings
.opcDataCollectionIntervalMilliseconds

specifies how often the data should be requested in milliseconds

Note

Setting it to 0 causes the data to be requested only when data values change.

Required - No default value

int32

0 to 2147483647

settings
.propertyMapList

specifies properties that represent the data being requested

Required - No default value

array of objects

settings
.propertyMapList
.propertyPath

specifies the JSON property that this data will be identified by

Required - No default value

string

settings
.propertyMapList
.opcNamespace

specifies the OPC namespace that this variable exists in

Required - No default value

int16

0 to 32767

settings
.propertyMapList
.opcNodeName

specifies the name of the OPC variable for this data

Required - No default value

string