FairCom provides specific API actions to configure the EtherNet/IP connector. Be sure to enable the Allen-Bradley service before requesting data from an Allen-Bradley service.
Note A connector is a bridge between a device/software and an integration table.
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":"abTest1",
"serviceName":"ab",
"thingName": "PLC 74",
"tableName":"abTable1",
"settings":{
"dataCollectionIntervalMilliseconds":5000,
"dataReadingTimeoutMilliseconds":5000,
"plcAddress":"192.142.100.22",
"plcType":"controllogix",
"propertyMapList":[
{
"eipTagPath":"1,0",
"eipTagName":"temperature",
"eipTagType":"float32",
"propertyPath":"temperature"
}
]
}
},
"requestId":"00000004",
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"api":"hub",
"action":"createInput",
"params":{
"inputName":"abTest1",
"serviceName":"ab",
"thingName": "PLC 74",
"dataPersistenceStrategy": "onChange",
"dataCollectionIntervalMilliseconds": 500,
"dataReadingTimeoutMilliseconds": 1000,
"dataWritingTimeoutMilliseconds": 1000,
"immediatelyCollectDataOnStart": true,
"dataCollectionBufferCount": 2,
"tableName":"abTable1",
"settings":{
"plcAddress":"192.142.100.22",
"plcType":"controllogix",
"propertyMapList":[
{
"eipTagPath":"1,0",
"eipTagName":"scada",
"eipTagElementCount":10,
"eipTagType":"int32",
"propertyPath":"scada" //Deprecated
},
{
"eipTagPath":"1,0",
"eipTagName":"temperature",
"eipTagType":"float32",
"tagName":"temperature"
},
{
"eipTagPath":"1,0",
"eipTagName":"message",
"eipTagType":"string",
"eipTagSize":20,
"tagId": 18
}
]
}
},
"requestId":"00000004",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Response examples
A response to a request is "0" when successful. A non-zero value response indicates an error occurred.
Collected JSON data
{
"create_ts":"2023-09-19T20:37:12.678Z",
"scada0":10,
"scada1":20,
"scada2":30,
"scada3":40,
"scada4":50,
"scada5":60,
"scada6":70,
"scada7":80,
"scada8":90,
"scada9":100,
"temperature":86.230003356933594,
"message":"AB rocks "
}
The Maximal request configures the Allen-Bradley connector to collect data from a ControlLogix PLC at address 192.142.100.22 every 5 seconds. It collects data from 3 tag addresses named "scada", "temperature", and "message". If it cannot read the tags within 1 second, it returns a timeout error.
In this example, the connector retrieved ten 32-bit integers from the PLC starting at the "scada" tag address and added each integer to the generated JSON as a separate property named "scadaN" where N is the zero-based array index number. In the PLC, the "scada" tag had an array containing the following ten integer values: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]. The generated JSON included the corresponding ten properties: "scada0":10, "scada1":20, "scada2":30, "scada3":40, "scada4":50, "scada5":60, "scada6":70, "scada7":80, "scada8":90, "scada9":100.
The connector also retrieved one Floating point number from the PLC starting at the tag address "temperature" and added it to the generated JSON as a property named "temperature". Because the connector retrieved only one value, it did not append an index number to the end of the "temperature" property name. In the PLC, the "temperature" tag was a floating-point number 86.230003356933594. The generated JSON included the corresponding property "temperature":86.230003356933594.
The connector then retrieved a 20-byte string from the PLC starting at the tag address "message" and added it to the generated JSON as a property named "message". Because the connector retrieved only one value, it did not append an index number to the end of the "message" property name. In the PLC, the "message" tag was the 20-byte string "AB rocks ". The generated JSON included the corresponding property "message":"AB rocks ".
The connector receives the collected JSON data in the source_payload field of a JSON document, and inserts it in a record in the "abTable1" table.
"eipTagName" options
If you want to read an array starting in the middle, add the first position inside square brackets as part of the tag name.
For example, the following request values would generate the following retrieved data.
Request values
{
"eipTagPath":"1,0",
"eipTagName":"scada[4]",
"eipTagElementCount":3,
"eipTagType":"int32",
"propertyPath":"scada"
}
Retrieved data
{
"create_ts":"2023-09-26T19:01:39.714Z",
"scada0":50,
"scada1":60,
"scada2":70
}In this example, the "scada" tag represents an array in the PLC containing the following ten integer values: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]. The tag array is zero-based.
The first element is [0] so "eipTagName": "scada[4]" collects data at the 5th item in the array, which has the value of 50. Specifying "eipTagElementCount": 3 collects 3 items from the array.
The connector generates JSON containing the properties "scada0":50, "scada1":60, and "scada2":70. These properties correspond to the properties named "scada4":50, "scada5":60, and "scada6":70 in the results from the Maximal example.
Success
{
"result": {},
"requestId": "00000007",
"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 |
|
dataReadingTimeoutMilliseconds |
The "dataReadingTimeoutMilliseconds" property specifies the timeout in milliseconds while connecting and reading data from the PLC. |
Optional with default of 1000
|
int32 |
0 and negative values are invalid. |
dataWritingTimeoutMilliseconds |
The "dataWritingTimeoutMilliseconds" property specifies the timeout in milliseconds while connecting and writing data to the PLC. |
Optional with default of 1000
|
int32 |
0 and negative values are invalid. |
description |
The "description" property assigns a description to a connector. |
Optional with default of ""
|
string | 1 to 512 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 |
|
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 |
purpose |
The "purpose" property specifies the purpose of the thing. You can use it for fast partial lookups and filtering. |
Optional with default of "unknown" |
string |
1 to 64 bytes Values are managed in the Label API with the group |
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 .plcAddress |
The "plcAddress" property specifies the IP address or hostname and optional port from the PLC, in the format IPaddress:Port, with Port being optional. |
Required - No default value | string |
Examples:
|
|
settings .plcType |
The
|
Required - No default value | string |
|
|
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 .eipTagElementCount |
The "eipTagElementCount" property specifies the number of elements in the tag. All tags are treated as arrays. Tags that are not arrays are considered to have a length of one element. |
Optional with default of 1
|
int32 | 0 and negative values are invalid. |
|
settings .propertyMapList .eipTagName |
The For CIP-based PLCs, use the format
PCCC-based PLC examples include |
Required - No default value | string | No limit |
|
settings .propertyMapList .eipTagPath |
The
|
Optional with default of "1,0"
|
string | String with the format "p,s"
|
|
settings .propertyMapList .eipTagSize |
The "eipTagSize" property specifies the binary format of the PLC data represented by the tag. |
Required - No default value | string |
"bit""int8""uint8""int16""uint16""int32""uint32""int64""uint64""float32""float64""byte""string"
|
|
settings .propertyMapList .eipTagType |
The If not specified, the buffer size is defined based on the For string Let the server define this property. and set it yourself only when necessary. |
Optional - depending on the dataType value | Integer |
0, 1, 2, 4, or 8
|
|
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. |
Required - No default value | string | JSON path |
|
settings propertyMapList .tagId |
The "tagId" property associates a tag with a value being collected by a connector. It is mutually exclusive with the "tagName" and "propertyPath" properties. See tagId for more details. |
Conditional - No default value | integer | If present, it must contain the ID of an existing tag, which is an integer from 0 to 9223372036854770000.Note FairCom recommends using this property instead of "propertyPath". |
|
settings propertyMapList .tagName |
The "tagName" property associates a tag with a value being collected by a connector. It is mutually exclusive with the "tagId" and "propertyPath" properties. See tagName for more details. |
Conditional - No default value | string |
If present, it must contain the name of an existing tag. Note FairCom recommends using this property instead of |
status |
The "status" property assigns an active or inactive status to a thing. An inactive status is like a soft delete. |
Optional with default of "active" | string enum |
|
tableName |
The The table name must start with an upper or lowercase letter, must not contain special characters other than underscore
"params": {
"tableName": "ctreeTable"
} |
Required - No default value | string | 1 to 64 bytes |
thingId |
The "thingId" property associates a connector with a device or software application. It is mutually exclusive with the "thingName" property. See thingId for more details. |
Optional with default of null
|
integer | If present, it must contain the ID of an existing thing, which is an integer form 0 to 9223372036854770000. |
thingName |
The "thingName" property associates a connector with a device or software application. It is mutually exclusive with the "thingId" property. See thingName for more details. |
Optional with default of null
|
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 .settings |
The |
object |
See these pages for connector specific properties: |
|
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: |
|
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 settings propertyMapList .tagId |
The "tagId" property associates a tag with a value being collected by a connector. It is mutually exclusive with the "tagName" and "propertyPath" properties. See tagId for more details. |
integer | If present, it must contain the ID of an existing tag, which is an integer from 0 to 9223372036854770000.Note FairCom recommends using this property instead of "propertyPath". |
|
data settings propertyMapList .tagName |
The "tagName" property associates a tag with a value being collected by a connector. It is mutually exclusive with the "tagId" and "propertyPath" properties. See tagName for more details. |
string |
If present, it must contain the name of an existing tag. Note FairCom recommends using this property instead of |
|
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 .thingId |
The "thingId" property associates a connector with a device or software application. It is mutually exclusive with the "thingName" property. See thingId for more details. |
integer | If present, it must contain the ID of an existing thing, which is an integer form 0 to 9223372036854770000. |
|
data .thingName |
The "thingName" property associates a connector with a device or software application. It is mutually exclusive with the "thingId" property. See thingName for more details. |
string | 1 to 64 bytes |