The "createOutput" action creates a new integration.
An integration connects data in the server to an output plugin that delivers tags from the server to external systems, such as connecting the integration table populated by OPC UA to the ThingWorx connector.
The data source for an output definition is an integration table.
An output plugin delivers tags from an integration table in FairCom Edge over an external protocol, such as OPC UA, to an external system, such as a device or Manufacturing Execution System (MES).
Each integration table can have zero or more integrations assigned to it. Thus, multiple plugins can read from the same integration table. For example, the MQTT and THINGWORX plugins can use the same integration table.
Note Use the
"configureTopic"action in the MQ API to connect MQTT to an existing integration table.A tag is a piece of named data with an associated value. For example, the tag
temperature 70includes both the named data temperature and the value70. In JSON, a tag is a JSON property, such as"temperature": 70. In a SQL table, a tag is a data field, such as a field named temperature with a value of70.
Request examples
Important The
"createOutput"action does NOT create an integration table. You must create an integration table with the"createIntegrationTable"action before calling"createOutput".
Minimal
{
"action": "createOutput",
"params": {
"outputName": "writeEverythingToModbus",
"serviceName": "modbus",
"databaseName": "faircom",
"tableName": "modbusTableTCP",
"settings": {
"modbusProtocol": "TCP",
"modbusServer": "127.0.0.1",
"modbusServerPort": 502,
"propertyMapList": [
{
"propertyPath": "source_payload",
"modbusDataAddress": 1199,
"modbusDataAccess": "holdingregister",
"modbusUnitId": 5,
"modbusDataLen": 1
}
]
}
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"api": "hub",
"action": "createOutput",
"params": {
"outputName": "writeTemperatureToModbus",
"serviceName": "modbus",
"databaseName": "faircom",
"tableName": "modbusTableTCPTemp",
"ownerName": "admin",
"sourceFields": [
"source_payload"
],
"settings": {
"modbusProtocol": "TCP",
"modbusServer": "127.0.0.1",
"modbusServerPort": 502,
"propertyMapList": [
{
"propertyPath": "source_payload.temperature",
"modbusDataAddress": 1199,
"modbusDataAccess": "holdingregister",
"modbusUnitId": 5,
"modbusDataLen": 1
}
],
"sourceDataField": "source_payload",
"sourceDataFormat": "JSON"
},
"metadata": {
"description": "This output copies the source_payload.temperature property to the Modbus listener at 127.0.0.1.",
"tags": [ "temperature" ]
}
},
"responseOptions": {
"binaryFormat": "hex",
"dataFormat": "objects",
"numberFormat": "string",
"includeFields": [ ],
"excludeFields": [ ]
},
"authToken": "replaceWithAuthTokenFromCreateSession",
"requestId": "2",
"debug": "max"
}
Response example
Success
{
"result": {},
"requestId": "00000004",
"errorCode": 0,
"errorMessage": "",
"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. 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 |
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 |
|
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 |
outputName |
The |
Optional with default of []
|
array |
1 or more strings |
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 |
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 Connector-specific "settings" |
Optional with default of {}
|
object | |
sourceFields |
The An integration table has many fields, such as fields populated by transforms and MQTT. Converting all fields into JSON is slower than converting only the fields needed by the output connector. For example, input connectors and MQTT messages store their data in the When you configure an output connector, you add |
Optional with default of []
|
array | One or more fields form the integration table. |
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 |