Siemens S7 API reference
Siemens S7 connector programming specifications
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 request
{
"api": "hub",
"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"
}
{
"api": "hub",
"action": "createInput",
"params": {
"inputName": "mysiemensS7",
"serviceName": "siemensS7",
"settings": {
"ipAddress": "127.0.0.1",
"rack": 0,
"slot": 2,
"packageSize": 500,
"dataCollectionIntervalMilliseconds": 1000,
"dataCollectionBufferCount": 5,
"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"
}
A response to a request is "0" when successful. A non-zero value response indicates an error occurred.
{
"result": {},
"requestId": "00000007",
"errorCode": 0,
"errorMessage": ""
}
Not yet available.
Siemens S7 connector programming specifications for FairCom Edge
The "params"
property is an object that contains an action's parameters. Each action defines its own required and optional properties.
Note
See createInput for "params"
properties that are common to all connectors.
"params"
properties summaryProperty | Description | Default | Type | Limits (inclusive) | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dataCollectionBufferCount | (optional) specifies the number of times the collector retrieves and caches data from the device before writing the data to the integration table |
| integer |
| |||||||||||||||||||||||
dataCollectionIntervalMilliseconds | (optional) specifies the number of milliseconds to wait until reading PLC data again. For example, |
| integer | co and negative values are invalid | |||||||||||||||||||||||
dataPersistenceStrategy | (optional) specifies when the connector writes collected data to the specified table |
| string |
| |||||||||||||||||||||||
immediatelyCollectDataOnStart | (optional) configures the input to collect data immediately when the server or connector starts. This occurs even if the data persistence strategy is to collect data changes |
| Boolean |
| |||||||||||||||||||||||
serviceName | specifies which type of input to create |
| string |
| |||||||||||||||||||||||
settings | specifies properties needed to configure the data source of the input |
| array of objects | ||||||||||||||||||||||||
| specifies the PLC/Equipment IPV4 Address. |
| string | ||||||||||||||||||||||||
| (optional) specifies the package size in bytes used to communicate with the PLC. Higher numbers allow the connector to retrieve more data in fewer requests. | If not specified, the PLD PDU size is used. | integer |
| |||||||||||||||||||||||
| specifies which data the connector requests and where to put it in the generated JSON. |
| array of objects | ||||||||||||||||||||||||
| (optional) specifies the number of consecutive The connector retrieves 3 one-byte values when The connector retrieves 2 four-byte values when If |
| integer |
| |||||||||||||||||||||||
| (optional) if |
| integer |
| |||||||||||||||||||||||
| specifies the number of the Data Block memory area where the connector retrieves data. It is ignored unless | Required if | integer |
| |||||||||||||||||||||||
| specifies the data type of memory retrieved by the connector. If If |
| string |
| |||||||||||||||||||||||
| specifies the type of memory area where the connector retrieves data. |
| string |
| |||||||||||||||||||||||
| specifies the offset to the starting byte in the memory area where the connector retrieves data. |
| integer |
| |||||||||||||||||||||||
| specifies the JSON path in the JSON document where the connector puts the data it collects. It is the tag name of the data being collected |
| string | ||||||||||||||||||||||||
| specifies the PLC Rack number. |
| integer |
| |||||||||||||||||||||||
| specifies the PLC Slot number. |
| integer |
|
How to horizontally scroll a table
To scroll the table right or left, mouse over the table, hold down shift , and move the mouse wheel down or up.
The "propertyPath"
property is a required string that specifies the JSON Path in the JSON document where the connector puts the data it collects. It is the tag name of the data being collected. You can use this property to take collected data and store it in any location in the JSON document generated by the connector. For example, the setting "propertyPath": "temperature"
causes the server to take a value it collects, such as 20.1
, and store it in a "temperature"
property, such as { "temperature": 20.1 }
.