testOutput

The "testOutput" is useful for testing a newly created or altered output. It tests if it can connect to the device based on an existing output's settings. It optionally returns device information and optionally pushes data to the device. To aid in troubleshooting, it returns the values pushed to the target system in the "sentValues" property.

If the action cannot connect to the device, it returns the device disconnected error to indicate the device is disconnected: "Cannot connect to device".

If "includeDeviceInformation":true, the action returns the "deviceInformation" property that describes the device, which helps a user confirm that they are connected to the correct device.

If "sendValues":true, the action sends values from the source record to the device. 

  • If the output's "propertyMapList" property is omitted, the action does not send data and returns the error: "Cannot send a record to the device because you need to add tags to the output's propertyMapList property."
  • The "sourceRecord" property specifies the record to send to the device. It defaults to "lastRecord". It may be set to the record's unique identifier, which is an integer number.
    • If the action cannot send records to the device because the specified ID is incorrect, it returns the error: "Output AAA Cannot send a record to the device XXX because record ID YYY cannot be found at table ZZZ. Use a different record ID." 
    • If the action cannot send the last record to the device because there are no records, it returns the error: "Output AAA Cannot send the last record to the device XXX because no records have been collected for table YYY."
       

Request examples

Connection-only test

This request only tests the output connection.

{
  "api": "hub",
  "action": "testOutput",
  "params": {
    "outputName": "someOutputName"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

Include Device Information

This request returns device information after connecting to the device.

{
  "api": "hub",
  "action": "testOutput",
  "params": {
    "outputName": "someOutputName",
    "includeDeviceInformation":true
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

Push Last Record

This request returns device information after connecting to the device and pushes the last inserted record to the device.

{
  "api": "hub",
  "action": "testOutput",
  "params": {
    "outputName": "someOutputName",
    "includeDeviceInformation":true,
    "sendValues":true,
    "sourceRecord": "lastRecord"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

Push Record 3

This request pushes the record with ID 3 to the device.

{
  "api": "hub",
  "action": "testOutput",
  "params": {
    "outputName": "someOutputName",
    "sendValues":true,
    "sourceRecord": "3"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

 

Response examples

Condensed

{
  "result": {
    "data": [
      {
        "outputName": "mod1",
        "settings": {          
          "propertyMapList": [
            {
              "propertyPath": "t1"
            },
            {
              "propertyPath": "t2"
            }
          ]
        },
        "sentValues" : {
           "create_ts": "2026-07-31T17:41:13.468000000Z",
           "t1": 22,
           "t2": 78 
        }
      }
    ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession",
  "errorCode": 0,
  "errorMessage": ""
}
 
 

Maximal

{
  "result": {
    "data": [
      {
        "id": 2,
        "outputName": "mod1",
        "serviceName": "modbus",
        "databaseName": "faircom",
        "ownerName": "admin",
        "tableName": "mod1",
        "retentionPolicy": "autoPurge",
        "retentionPeriod": 4,
        "retentionUnit": "week",
        "settings": {
          "modbusProtocol": "TCP",
          "modbusServer": "127.0.0.1",
          "modbusServerPort": 502,
          "dataCollectionIntervalMilliseconds": 5000,
          "dataPersistenceStrategy": "onSchedule",
          "immediatelyCollectDataOnStart": false,
          
          "propertyMapList": [
            {
              "modbusDataAccess": "holdingregister",
              "modbusDataAddress": "4003",
              "modbusDataLen": null,
              "modbusDataType": "int8Signed",
              "modbusUnitId": "1",
              "propertyPath": "t1"
            },
            {
              "modbusDataAccess": "holdingregister",
              "modbusDataAddress": "4005",
              "modbusDataLen": null,
              "modbusDataType": "int8Signed",
              "modbusUnitId": "1",
              "propertyPath": "t2"
            }
          ]
        }

        "deviceInformation": {
          "productUri": "",
          "deviceType": "",
          "manufacturerName": "",
          "productName": "",
          "model": "",
          "serialNumber": "",
          "softwareVersion": "",
          "buildNumber": "",
          "buildDate": "",
          "userApplicationName": "",
          "deviceState": "",
          "heartbeatTime": "",
          "assetId": ""
        },
        
        "sentValues" : {
           "create_ts": "2026-07-31T17:41:13.468000000Z",
           "t1": 22,
           "t2": 78 
        }
      }
    ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession",
  "requestId": "00000004",
  "errorCode": 0,
  "errorMessage": ""
}
 
 

 

Properties

Request properties ("params")

Property Description Default Type Limits (inclusive)

id

The "id" property specifies the unique identifier of an output connector.  Conditional - Required if "outputName" property is omitted. - No default value number or string 1 to 9223372036854770000

includeDeviceInformation

When true, the "includeDeviceInformation" property tests the connection to the object and returns its device information.  false Boolean

true

false

outputName

The "outputName" property specifies the unique name of an output connector. Conditional - Required if "id" property is omitted. - No default value string 1 to 64 bytes

sendValues

When present and true, the "sendValues" property sends the specified source record to the device. false Boolean

true

false

sourceRecord

When present, the "sourceRecord" property specifies the record to use for the data being sent to the target device. It is either the record's ID value or the string "lastRecord". "lastRecord" string "lastRecord" or ID of the record

 

Response properties ("result")

Property Description Type Limits (inclusive)

data

The "data" property contains a response message. Its contents are defined by the action. It is an empty array when no results are available. 

array of objects The action determines its contents.

data

.databaseName

The "databaseName" property specifies the database that contains the tables. 

Note In the API Explorer, "defaultDatabaseName" is set to "ctreeSQL" in the "createSession" action that happens at login.

  • If the "databaseName" property is omitted or set to null, the server will use the default database name specified at login.
  • If no default database is specified during "createSession", "databaseName" will be set to the "defaultDatabaseName" value that is specified in the services.json file.
  • This property's value is case insensitive. 
string 1 to 64 bytes

data

.deviceInformation

The "deviceInformation" property contains a standard set of properties that describe the device.  object No limits

data

.id

The "id" property is the unique identifier of an object. In JSON, you may use an integer number or a string containing an integer number. The server automatically generates the "id" when you create a label and stores it in the label table as an integer. You cannot alter the "id" value. If your application needs to specify a specific numeric identifier for a label, use the "enum" property.

integer 0 to 2147483647

data

.outputName

The "outputName" property specifies a unique name for mapping an integration table to an output plugin to an external system. string 1 to 64 bytes

data

.ownerName

The "ownerName" property identifies the user who owns an object (see Object owner).  string 0 to 64 bytes

data

.retentionPeriod

The "retentionPeriod" property specifies how many units of data to retain. It refers to the unit of time specified by the "retentionUnit" property. For more details, see "retentionPeriod".

integer 1 to 100

data

.retentionPolicy

The "retentionPolicy" property controls how messages are persisted. 

If not specified, the default found in the services.json file is used. Initially, it is "autoPurge".

 

retentionPolicy values:
  • "autoPurge"
    • This is the default. It is automatically applied when a new topic is created. It is preferred because it allows FairCom's servers to automatically remove messages that are older than the retention time. This helps ensure message data does not consume all storage space. It also minimizes storage costs and speeds up data access. The server partitions a table into multiple files so it can efficiently delete expired files.
  • "neverPurge"
    • This stores messages on disk and never removes them. This is useful when you need the entire history of the message stream. If message velocity is high, this can consume all storage space and cause an outage. The server creates a non-partitioned table, which is slightly faster than a partitioned table because it stores all records in one file.
string

"autoPurge"

"neverPurge"

data

.retentionUnit

The "retentionUnit" property specifies a unit of time that the server will use to purge expired messages. For example, if you want a week's worth of messages to be purged once a week, set "retentionUnit" to "week". This property is optional.

If not specified, the default found in the services.json file is used. Initially, it is "week". 

  • This property is used in concert with "retentionPeriod" to determine retention time.
  • "retentionUnit" values:
    • "minute"
    • "hour"
    • "day"
    • "week"
    • "month"
    • "year"
    • "forever"

Note 

  • For best performance, set the "retentionUnit" to a value that keeps "retentionPeriod" between 5 and 30. 
  • When you set "retentionUnit" property to "forever" the server will not purge messages. This setting is the same as setting "retentionPolicy" to "neverPurge".
  • The "retentionUnit" and "retentionPeriod" properties are used only when the "retentionPolicy" is set to "autoPurge".

string

"minute"

"hour"

"day"

"week"

"month"

"year"

data

.sentValues

The "sentValues" property contains the values sent to the connector for each property in the "propertyMapList". The type of value depends on the type of data sent to the device.  JSON No limits

data

.serviceName

The "serviceName" property contains the name of a FairCom input or output service. 

See the "params" topic of each specific service for the requirements of this property.

The following services are available as of the V5 release:
  • "MODBUS"
  • "SIEMENSUDT2JSON"
  • "OPCUA"

Note The SQL, JSON RPC, and REST services can automatically query any integration table in FairCom's servers without requiring configuration.

Note MQTT always represents both input and output services. This is because once a topic is created and assigned to an integration table, any MQTT client can publish messages to it and subscribe to those messages.

string A service name between 1 and 64 bytes.

data

.settings

The "settings" property contains properties that are specific for each connector type. Settings for Modbus are different than settings for OPC UA, and so forth. See the API reference "params" property of each connector for details of the "settings" property for that connector.

object

See these pages for connector specific properties:

Allen-Bradley "params"

Modbus "params"

OPC UA "settings"

Siemens S7 "params"

data

settings

.propertyMapList

The "propertyMapList" property specifies which data the connector requests and where to put it in the generated JSON. array of objects

See these pages for connector specific properties:

Allen-Bradley "params"

Modbus "params"

OPC UA "settings"

Siemens S7 "params"

data

settings

propertyMapList

.propertyPath

The "propertyPath" property specifies the JSON path in the JSON document where the connector puts the data it collects. It is mutually exclusive with the "tagName" and "tagId" properties. string JSON path

data

.tableName

The "tableName" property is a string containing the name of a table.

The table name must start with an upper or lowercase letter, must not contain special characters other than underscore "_", and can include a mix of upper-lower case characters, but are treated as case-insensitive.

string 1 to 64 bytes