"createOutput"
createOutput creates and new integration.
The "createOutput"
action creates a new integration.
Things to know
An integration connects data in the server to an output plugin that delivers data 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 data 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
"mqtt_configureTopic"
to connect MQTT to an existing integration table.
Request examples
Minimal request example
{ "authToken":"anAuthorizationTokenFromTheServer", "api":"hub", "action":"createOutput", "params":{ "outputName":"rest1", "tableName":"modbusTableTCP", "serviceName":"rest", "settings":{ "host":"127.0.0.1:1880", "uri":"/equipment/2/alert", "body":[ { "propertyPath":"Temperature", "propertyValue":{ "fromSourcePropertyPath":{ "formatString":" <%temperature%> " } } } ] } } }
{ "authToken":"anAuthorizationTokenFromTheServer", "api":"hub", "action":"createOutput", "params":{ "serviceName":"rest", "outputName":"rest1", "tableName": "modbusTableTCP", "outputFieldName": "source_payload", "settings":{ "host": "127.0.0.1:1880", "uri": "/equipment/2/alert", "headers":[ "tenantId: 99,01", "X-erp-module: MNT" ], "body":[ { "propertyPath": "equipment", "propertyValue": {"fromConstant": "0002"} }, { "propertyPath": "description", "propertyValue": { "fromSourcePropertyPath": { "formatString": "Temperature is too high. Please, verify. Temperature = <%temperature%>." } } } ], "threshold":{ "expression": "temperature > 60" } } } }
Response example
{ "authToken": "anAuthorizationTokenFromTheServer", "result": {}, "requestId": "00000004", "errorCode": 0, "errorMessage": "" }
"params"
The "params"
property is an object that contains an action's parameters. Each action defines its own required and optional properties.
Property summary
"params"
property summariesProperty | Description | Default | Type | Limits (inclusive) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
specifies the name of a database | Defaults to the | string |
| |||||||||||
exists primarily for the user interface to find integration information |
| object | May contain any number and type of user-defined properties | |||||||||||
| contains a unique name for mapping of an integration table to an output plugin to an external system | A FairCom generated name that follows the pattern | string |
| ||||||||||
| contains the name of a service that collects data from an external source and inserts it into an integration table | Required - No default value | string |
| ||||||||||
contains properties needed to configure the data source of the specified plugin |
| object | ||||||||||||
specifies the field that the MQTT Subscription engine should use as the payload when it sends the payload to subscribers |
| string |
| |||||||||||
specifies the name of a table | Required - No default value | string |
|
The "databaseName"
property is an optional string that specifies the database that contains the tables. It defaults to the database name supplied at login.
Note
In the API Explorer, "defaultDatabaseName"
is set to "ctreeSQL"
in the "createSession"
action that happens at login.
A zero-length
"databaseName"
is invalid.Its limits are from 0 to 64 bytes.
If the
"databaseName"
property is omitted or set tonull
, the server will use the default database name specified at login.If no default database is specified during
"createSession"
,"defaultDatabaseName"
will be set to the"defaultDatabaseName"
value that is specified in theservices.json
file.
The "metadata"
property is an optional JSON object. It exists primarily for the user interface to find integration information. By default, it is an empty JSON object.
It contains a flexible set of properties.
It typically contains tags and description properties.
Example
{ "description": "", "tags": [""], "yourOwnProperties": "usage, purpose, notes, location, etc.", }
Property summary
Property | Description | Default | Type | Limits |
---|---|---|---|---|
"host" | contains the IP or hostname of the Rest resource, including the port | Required - No default | string | |
"uri" | contains the identifier name of the REST resource | Required - No default | string | |
"headers" | contains additional information about the request. It is a list of elements with the key-value format | Optional | List of strings with the format | |
"body" | contains information to send to a REST server. | Optional | array of objects | |
"body"."propertyPath" | specifies the name of data to be defined by "propertyValue". | [Required] No default | string | |
contains an array of properties that define the data of a named "propertyPath". | [Required] No default. | object | ||
"threshold" | contains properties that define the threshold for sending a REST command |
This is a required object that contains properties that define the data values of a "propertyPath". It is required and has no default value.
The data values specified in the "propertyValue" object can be a string or an object.
"fromConstant" indicates the value is a string. For example —
"propertyValue": {"fromConstant": "0002"}
"fromSourcePropertyPath" indicates the value is an object. For example —
"propertyValue": {"fromSourcePropertyPath": { "formatString": "Temperature = <%input_temp%>" }}
Characters in the "formatString" value that are enclosed by "
<%
" and "%>
", specify the name as an input property that will be replaced by an input property value.Here is a REST command example for the
"propertyPath"
named"description"
, that received an input_temp value of 103:{ description: "Temperature = 103."}
If the input value is not found, it is replaced with NULL:
{ description: "Temperature = NULL."}
The "outputFieldName"
property is an optional string that contains the name of a field from an integration table. It defaults to "source_payload"
.
The "tableName"
property is an optional string that contains the name of an integration table or MQTT topic that holds the topic's messages. It defaults to an empty string.
You can use a topic name for an MQTT table because FairCom automatically generates a table name for each topic.
A
"tableName"
cannot begin with a number.It refers to the name of the integration table that stores a topic’s messages and is used to rename that table or assign a new topic to an existing integration table.
MQTT automatically creates an integration table for each new topic it receives. Thus, when a message is sent to a topic, FairCom Edge automatically creates a table to hold it.
As you refine your integration processes, you may want to rename an integration table to better label the data it holds. You can use the
"tableName"
property of the"configureTopic"
action to rename an integration table.The
"alterIntegrationTable"
action can also be used to rename an integration table, but it is less convenient because you must know the original name of the integration table.