GraphQL
Tentacle PLC has a GraphQL API which allows external applications (like REST clients and Tentacle PLC) to interact with it programmatically.
Schema Types
Table of Contents
Query
Read only queries
Field | Argument | Type | Description |
---|---|---|---|
info | String! | Information about the Tentacle PLC environment as a string. | |
metrics | [taskMetric!]! | Task diagnostic data | |
value | atomicVariable | Single value of an atomic variable or class property.Example path for classes: motor1.running where motor1 is the class instance and running is a property of motor1's class. | |
variablePath | String! | ||
values | [atomicVariable!]! | Lists all variable and class property values | |
variables | [Variable!]! | Lists all variables | |
programs | [String!]! | Lists all programs | |
program | String! | Returns the code for a single program | |
name | String! | ||
classes | [String!]! | Lists all classes | |
class | String! | Returns the code for a single class | |
name | String! | ||
configuration | config! | The current configration | |
changes | [change!]! | Lists all file changes that have occurred since the last PLC restart | |
plc | Plc! | The PLC status information |
Mutation
Read/Write queries
Field | Argument | Type | Description |
---|---|---|---|
setValue | atomicVariable | Sets the value of an atomic variable. Can only target a single atomic variable or the property of a class. Example path for classes: motor1.running where motor1 is the class instance and running is a property of motor1's class. | |
variablePath | String! | ||
value | String! | ||
runFunction | String | Run the function of a class.Example path for classes: motor1.start where motor1 is the class instance and start is a property of motor1's class. | |
functionPath | String! | ||
args | String | ||
startPlc | Plc | Start the PLC runtime if stopped. | |
stopPlc | Plc | Stop the PLC runtime. | |
restartPlc | Plc | Stop the PLC runtime, if running, and the start the PLC with the latest runtime configration. |
Objects
Plc
PLC status and diagnostics information
Field | Argument | Type | Description |
---|---|---|---|
running | Boolean! |
Variable
Variable configuration
Field | Argument | Type | Description |
---|---|---|---|
name | String! | ||
description | String | ||
datatype | String! | ||
initialValue | String | ||
persistent | Boolean | ||
source | VariableSource | ||
children | [Variable!]! |
VariableSource
Variable external source basic configuration
Field | Argument | Type | Description |
---|---|---|---|
type | String! | ||
name | String! | ||
rate | Int! | ||
params | VariableSourceParams |
VariableSourceParams
Variable exertnal source parameters, used to configure the source specific to the protocol used
Field | Argument | Type | Description |
---|---|---|---|
register | Int! | ||
registerType | String! | ||
format | String! |
atomicVariable
Atomic Variable type used for String, Numbers, and Booleans
Field | Argument | Type | Description |
---|---|---|---|
path | String! | ||
value | String | ||
datatype | String! |
change
File change type to use for change log (since last runtime update)
Field | Argument | Type | Description |
---|---|---|---|
event | String! | ||
path | String! |
config
Overall Tentacle PLC configration
Field | Argument | Type | Description |
---|---|---|---|
tasks | [configTask!]! | ||
mqtt | [configMqtt!]! | ||
modbus | [configModbus!]! |
configModbus
Modbus client basic configuration
Field | Argument | Type | Description |
---|---|---|---|
name | String! | ||
description | String! | ||
config | configModbusConfig! |
configModbusConfig
Modbus client configuration
Field | Argument | Type | Description |
---|---|---|---|
host | String | ||
port | Int | ||
unitId | Int | ||
reverseBits | Boolean | ||
reverseWords | Boolean | ||
zeroBased | Boolean | ||
retryRate | Int |
configMqtt
MQTT Client basic configuration
Field | Argument | Type | Description |
---|---|---|---|
name | String! | ||
description | String! | ||
config | configMqttConfig! |
configMqttConfig
Mqtt client configuration
Field | Argument | Type | Description |
---|---|---|---|
serverUrl | String | ||
groupId | String | ||
username | String | ||
password | String | ||
edgeNode | String | ||
deviceName | String | ||
clientId | String | ||
version | String |
configTask
Task configuration
Field | Argument | Type | Description |
---|---|---|---|
name | String! | ||
description | String! | ||
scanRate | Int! | ||
program | String! |
taskMetric
Task metrics for diagnostic data
Field | Argument | Type | Description |
---|---|---|---|
task | String! | ||
functionExecutionTime | Float! | ||
intervalExecutionTime | Float! | ||
totalScanTime | Float! |
Scalars
Boolean
The Boolean
scalar type represents true
or false
.
Float
The Float
scalar type represents signed double-precision fractional values as specified by IEEE 754.
Int
The Int
scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
String
The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
Examples
Query - PLC Running Status
Body:
query { plc { running } }
Response:
{ "data": { "plc": { "running": true } } }
Postman Snippet:
Mutation - Restart PLC
Body:
mutation { restartPlc { running } }
Response:
{ "data": { "restartPlc": { "running": true } } }
Postman Snippet: