FairCom provides specific API actions to configure the Siemens S7 connector. Be sure to enable the Siemens S7 service before requesting data from a Siemens S7 server.
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": "mySiemensS7",
"serviceName": "siemensS7",
"settings": {
"ipAddress": "127.0.0.1",
"rack": 0,
"slot": 2,
"dataCollectionIntervalMilliseconds": 5000,
"propertyMapList": [
{
"propertyPath": "flag1",
"memoryArea": "db",
"dataBlockNumber": 1,
"offset": 0,
"dataType": "word"
}
]
},
"tableName": "siemensS7Table"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"api": "hub",
"action": "createInput",
"params": {
"inputName": "mysiemensS7",
"serviceName": "siemensS7",
"dataPersistenceStrategy": "onChange",
"dataCollectionIntervalMilliseconds": 500,
"immediatelyCollectDataOnStart": true,
"dataCollectionBufferCount": 2,
"settings": {
"ipAddress": "127.0.0.1",
"rack": 0,
"slot": 2,
"packageSize": 500,
"propertyMapList": [
{
"propertyPath": "status",
"memoryArea": "db",
"dataBlockNumber": 1,
"offset": 0,
"amount": 1,
"dataType": "bit",
"bitPosition": 3
},
{
"propertyPath": "nerrors",
"memoryArea": "db",
"dataBlockNumber": 1,
"offset": 2,
"amount": 3,
"dataType": "doubleword"
},
{
"propertyPath": "temperature",
"memoryArea": "db",
"dataBlockNumber": 1,
"offset": 20,
"amount": 2,
"dataType": "real"
}
]
},
"databaseName": "ctreeSQL",
"ownerName": "admin",
"tableName": "siemensS7Table",
"retentionPolicy": "autoPurge",
"retentionPeriod": 30,
"retentionUnit": "day",
"metadata": {
}
},
"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": ""
}
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. 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 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 |
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 |
|
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 |
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 |
retentionPeriod |
The |
Optional with default of |
integer |
1 to 100
|
retentionPolicy |
The If not specified, the default found in the
retentionPolicy values:
|
Optional with default of |
string |
|
retentionUnit |
The If not specified, the default found in the
|
Optional with default of |
string |
|
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 .dataCollectionIntervalMilliseconds |
The |
Optional with default of 10000 (10 seconds). |
integer |
0 and negative values are invalid. |
|
settings .ipAddress |
The "ipAddress" property specifies the PLC/Equipment IPV4 Address. |
Required - No default value | string | A valid IP address |
|
settings .packageSize |
The Higher numbers allow the connector to retrieve more data in fewer requests. If not specified, the PLD PDU size is used. |
Optional with default between 240 and 960
|
integer |
240 to 960
|
|
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 .amount |
The The connector retrieves 3 one-byte values when The connector retrieves 2 four-byte values when If |
Optional with default of 1
|
integer |
1 to 65535
|
|
settings propertyMapList .bitPosition |
If "dataType":"bit", "bitPosition" defines which of the eight zero-based bits to read from the byte the connector retrieves. |
Optional with default of 0
|
integer |
0 to 7
|
|
settings propertyMapList .dataBlockNumber |
The It is ignored unless |
Required if "memoryArea": "db"
|
integer |
1 to 65535
|
|
settings propertyMapList .dataType |
The If If |
Required - No default value | string |
|
|
settings propertyMapList .memoryArea |
The "memoryArea" property specifies the type of memory area where the connector retrieves data. |
Required - No default value | string |
|
|
settings propertyMapList .offset |
The "offset" property specifies the offset to the starting byte in the memory area where the connector retrieves data. |
Required - No default value | integer |
0 to 4294967296
|
|
settings propertyMapList .propertyPath |
The "propertyPath" property specifies the name of the data to be defined by "propertyValue". |
Required - No default value | string | 0 to 256 bytes |
|
settings .rack |
The "rack" property specifies the PLC Rack number. |
Required - No default value | integer |
0 to 7
|
|
settings .slot |
The "slot" property specifies the PLC Slot number. |
Required - No default value | integer |
1 to 31
|
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 |