The "alterInput" action alters an existing input connector in FairCom Edge to collect tags automatically from a device or software system. Before you can alter an input, you must use "createInput" to create it.
Note 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.
-
"alterInput"modifies how an input service collects data from a data source, transforms it, and inserts it into an integration table.- For example, an input can configure the OPC UA service to collect data from an external source and write that data to an integration table in FairCom Edge.
- You can do the following:
- You can change the settings of an input.
- You can change the transforms applied to the data when it is inserted into the integration table.
- You can change metadata about the input to make it easier to locate.
- You cannot do the following:
- You cannot change the mapping between the service and the integration table. To do this, you need to create a new input and delete the old one.
- You cannot remap a connector service to a different integration table because this mapping is fundamental to the nature of the input. In the future, we may enhance this action to be able to remap the connector service to a different integration table, or we may provide a special action just for this purpose.
- The action,
"alterInput", is the only way to configure an existing input. If the specified value of"inputName"does not find an existing input, this action returns an error. To create an input, use the"createInput"action.
- The action,
Request examples
Minimal
{
"action": "createInput",
"params": {
"inputName": "modbusTCP",
"serviceName": "modbus",
"settings": {
"modbusProtocol": "TCP",
"modbusServer": "127.0.0.1",
"modbusServerPort": 502,
"propertyMapList": [
{
"propertyPath": "temperature",
"modbusDataAccess": "holdingregister",
"modbusDataAddress": 1199,
"modbusUnitId": 5,
"modbusDataLen": 1
}
]
},
"tableName": "modbusTableTCP"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}RTU request
{
"api": "hub",
"action": "createInput",
"params": {
"inputName": "modbusRTU",
"serviceName": "modbus",
"dataPersistenceStrategy": "onChange",
"dataCollectionIntervalMilliseconds": 5000,
"immediatelyCollectDataOnStart": true,
"dataCollectionBufferCount": 2,
"settings": {
"modbusProtocol": "RTU",
"modbusSerialPort": "COM2",
"modbusBaudRate": 19200,
"modbusParity": "None",
"modbusDataBits": 8,
"modbusStopBits": 2,
"propertyMapList": [
{
"propertyPath": "temperature",
"modbusDataAccess": "holdingregister",
"modbusDataAddress": 1199,
"modbusUnitId": 5,
"modbusDataLen": 1
}
]
},
"tableName": "modbusTableRTU"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal request
{
"api": "hub",
"action": "createInput",
"params": {
"inputName": "modbusTCP",
"serviceName": "modbus",
"dataPersistenceStrategy": "onChange",
"dataCollectionIntervalMilliseconds": 5000,
"immediatelyCollectDataOnStart": true,
"dataCollectionBufferCount": 2,
"settings": {
"modbusProtocol": "TCP",
"modbusServer": "127.0.0.1",
"modbusServerPort": 502,
"modbusDataAddressType": "zeroBased",
"propertyMapList": [
{
"propertyPath": "temperature",
"modbusDataAddress": 1199,
"modbusDataAccess": "holdingregister",
"modbusUnitId": 5,
"modbusDataLen": 1,
"modbusDataType": "int16SignedAB"
},
{
"propertyPath": "volume",
"modbusDataAddress": 1299,
"modbusDataAccess": "holdingregister",
"modbusUnitId": 5,
"modbusDataLen": 2,
"modbusDataType": "ieeeFloat32ABCD"
},
{
"propertyPath": "status",
"modbusDataAddress": 1199,
"modbusDataAccess": "coil",
"modbusUnitId": 5,
"modbusDataLen": 1,
"modbusDataType": "int8Signed"
}
]
},
"ownerName": "admin",
"tableName": "modbusTableTCP",
"metadata": {}
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Turn on data collection
The following example turns on data collection for the specified input.
{
"action": "alterInput",
"params": {
"inputName": "INPUT: PLC 74 & Modbus",
"serviceName": "modbus",
"enabled": true
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Response examples
A response to a request is "0" when successful. A non-zero value response indicates an error occurred.
Success
{
"result": {},
"requestId": "00000007",
"errorCode": 0,
"errorMessage": ""
}Failure
{
"result": {},
"requestId": "00000011",
"debugInfo": {
"request": {
"api": "hub",
"action": "createInput",
"params": {
"inputName": "modbusTCP",
"serviceName": "modbus",
"settings": {
"modbusProtocol": "TCP",
"modbusServer": "127.0.0.1",
"modbusServerPort": 502,
"propertyMapList": [
{
"propertyPath": "temperature",
"modbusDataAddress": "holdingregister",
"modbusDataAddress": 1199,
"modbusUnitId": 5,
"modbusDataLen": 1
}
]
},
"tableName": "modbusTableTCP"
},
"requestId": "00000011",
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
},
"errorCode": 12012,
"errorMessage": "There is already an integration with name of [modbusTCP].",
"authToken": "replaceWithAuthTokenFromCreateSession"
}Turn on data collection
{
"result": {
"data": [
{
"inputName": "INPUT: PLC 74 & Modbus",
"serviceName": "modbus",
"thingName": "PLC 74",
"tableName": "temperature",
"enabled": true,
"running": true,
"stopCode": 0,
"stopReason": "",
"dataCollectionIntervalMilliseconds": 1000,
"settings": {
"modbusProtocol": "TCP",
"modbusServer": "127.0.0.1",
"modbusServerPort": 502,
"propertyMapList": [
{
"tagName": "plc74_modbus_temperature",
"sourceFieldName": "temperature_celsius",
"sourcePayloadPath": "celsius",
"propertyPath": "celsius",
"modbusDataAddress": 2000,
"modbusDataAccess": "inputRegister",
"modbusUnitId": 5,
"modbusDataLen": 1
}
]
},
"databaseName": "ctreeSQL",
"ownerName": "admin",
"tableName": "modbustabletcp",
"metadata": {
},
"retentionPolicy": "autoPurge",
"retentionPeriod": 30,
"retentionUnit": "day"
}
]
},
"requestId": "00000027",
"errorCode": 0,
"errorMessage": ""
}
Properties
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
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 |
|
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 |
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 | |
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 .databaseName |
The
|
string | 1 to 64 bytes |
|
data .dataCollectionIntervalMilliseconds |
The |
integer |
0 and negative values are invalid. |
|
data .enabled |
|
boolean |
truefalse
|
|
data .inputName |
The "inputName" property specifies the unique name of an input. |
string | 1 to 64 bytes |
|
data .metadata |
The |
JSON | 0 to 65,500 bytes |
|
data .ownerName |
The "ownerName" property identifies the user who owns an object (see Object owner). |
string | 0 to 64 bytes |
|
data .retentionPeriod |
The |
integer |
1 to 100
|
|
data .retentionPolicy |
The If not specified, the default found in the
retentionPolicy values:
|
string |
|
|
data .retentionUnit |
The If not specified, the default found in the
|
string |
|
|
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 .serviceName |
The See the The following services are available as of the V5 release:
|
string | A service name between 1 and 64 bytes. |
|
data .settings |
The |
object | |
|
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 |
|
data .tableName |
The See table name in System limits for the table naming requirements and limitations. |
string | 1 to 64 bytes |
|
data .thingName |
The "thingName" property specifies the unique name of a thing. |
string | 1 to 64 bytes |