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.
Note A return value of
0signals the successful completion of an action.
Request examples
Note The FairCom createInput JSON action is used to define the specifics of a connector device and the desired data.
Minimal
{
"action": "createInput",
"params": {
"inputName": "opcDS1",
"serviceName": "opcua",
"settings": {
"opcServerUrl": "opc.tcp://MyOPCDevice.com:4840",
"propertyMapList": [
{
"propertyPath": "the_answer",
"opcNamespace": 1,
"opcNodeName": "the.answer"
}
]
},
"tableName": "opcTable1"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"requestId": "19",
"api": "hub",
"apiVersion": "1.0",
"action": "createInput",
"params": {
"inputName": "opcDS2",
"serviceName": "opcua",
"dataPersistenceStrategy": "onChange",
"dataCollectionIntervalMilliseconds": 5000,
"immediatelyCollectDataOnStart": true,
"dataCollectionBufferCount": 2,
"settings": {
"opcServerUrl": "opc.tcp://MyOPCDevice.com:4840",
"opcServerUser": "MyUser",
"opcServerPassword": "MyPassword",
"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": {
}
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Properties
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
databaseName |
The You specify this property when you want to use a different database instead of the default. Your session's account must have the appropriate privileges to access the code package. This property is useful because objects, such as tables and code packages, can have the same name in multiple databases. This feature allows you to create multiple environments in the same server and reuse the same JSON actions in each environment. For example, you can create It is an error to set If no default database is specified during |
Defaults to the session's "defaultDatabaseName" property |
string | 1 to 64 bytes |
dataCollectionBufferCount |
The This option combines multiple data collection events and inserts them into the integration table as one MQTT message. If this value is more than |
Optional with default of 1
|
integer |
1 to 65535
|
dataCollectionIntervalMilliseconds |
The |
Optional with default of 10000 (10 seconds). |
integer |
0 and negative values are invalid. |
dataPersistenceStrategy |
The
|
Optional with default of "onSchedule"
|
string |
|
enabled |
The "enabled" property turns on or off an input or output connector. Thus, it pauses or starts data collection or delivery. |
Optional with default of true
|
Boolean |
|
enabledFilter |
The "enabledFilter" property returns input connections that are enabled or not. Omit or set to null to match all connections. |
Optional with default of null
|
Boolean |
|
immediatelyCollectDataOnStart |
The
|
Optional with default of false
|
Boolean |
|
inputName |
The "params": {
"inputName": "modbusTCP",
"serviceName": "modbus"
} |
Required - No default value |
string | 1 to 100 bytes |
metadata |
The "metadata" property contains user-defined properties that add keywords and tags about the code package. The server indexes this field with a full-text index so you can search for any word or phrase to find code packages. |
Optional with default of {}
|
object | 0 or more key/value pairs |
ownerName |
The You specify this property when you want to use a different account instead of the default. Your session's account must have the appropriate privileges to access the code package. This property is useful because objects, such as tables and code packages, can have the same name in the same database as long as different accounts own each object. This feature allows you to create duplicate objects for different users on the same server and reuse the same JSON actions on those objects. For example, an administrator can copy objects from a production environment to her account so she can troubleshoot an issue using the same JSON actions, JavaScript, and SQL code. It is an error to set If no default owner is specified during |
Optional with default of the session's "defaultOwnerName" property |
string | 1 to 64 bytes |
retentionPeriod |
The |
Optional with default of |
integer |
1 to 100
|
retentionPolicy |
The If not specified, the default found in the
retentionPolicy values:
|
Optional with default of |
string |
|
retentionUnit |
The If not specified, the default found in the
|
Optional with default of |
string |
|
runningFilter |
The "runningFilter" property returns input connections that are running or not. Omit or set to null to match all connections. |
Optional with default of null
|
Boolean |
|
serviceName |
The See the The following services are available as of the V5 release:
|
Required - No default value | string | 1 to 64 bytes |
settings |
The
|
Optional with default of {}
|
object | |
|
settings .opcServerPassword |
The "opcServerPassword" property specifies the password for your OPC UA device. |
Optional with default of ""
|
string | No limit |
|
settings .opcServerUrl |
The "opcServerUrl" property specifies the IP or URL to your OPC UA device, including the port. |
Required - No default value | string | No limit |
|
settings .opcServerUser |
The "opcServerUser" property specifies the username for your OPC UA device. |
Optional with default of ""
|
string | No limit |
|
settings .propertyMapList |
The "propertyMapList" property specifies which data the connector requests and where to put it in the generated JSON. |
Required - No default value | array of objects |
zero or more objects containing zero or more of the following properties:
|
|
settings propertyMapList .opcNamespace |
The "opcNamescpace" property specifies the OPC UA namespace that this variable exists in. |
Required - No default value | int16 |
0 to 32767
|
|
settings propertyMapList .opcNodeName |
The "opcNodeName" property specifies the name of the OPC UA variable for this data. |
Required - No default value | string | No limit |
|
settings propertyMapList .propertyPath |
The "propertyPath" property specifies the name of the data to be defined by "propertyValue". |
Required - No default value | string | 0 to 256 bytes |
tableName |
The See table name in System limits for the table naming requirements and limitations.
"params": {
"tableName": "ctreeTable"
} |
Required - No default value | string | 1 to 64 bytes |
Response properties ("result")
| Property | Description | Type | Limits (inclusive) |
|---|---|---|---|
data |
The |
array of objects | The action determines its contents. |
|
data .enabled |
|
boolean |
truefalse
|
|
data .running |
The "running" property is true when an input connector is collecting data or an output connector is delivering data; otherwise, it is false. A disabled connector will never be running. An enabled connector may or may not be running. |
Boolean |
|
|
data .stopCode |
The "stopCode" property is 0 when the connector is successfully connected to its device or software; otherwise, it is non-zero. |
integer |
-2147483648 to 2147483647
|
|
data .stopReason |
The "stopReason" property is "" when the input connector is collecting data; otherwise, it is a non-empty string. |
string | 0 to 256 bytes |