Send the operation request to OpenGate
The following request creates the operation job that sends the operation to your device.
curl 'https://api.opengate.es/north/v80/operation/jobs' \
-H 'X-ApiKey: your-api-key' \
-H 'Content-Type: application/json' \
-H 'Accept: */*' \
--data '{
"job": {
"request": {
"operationParameters": {
"timeout": 90000,
"retries": 0,
"retriesDelay": 0,
"retryResultList" : []
},
"name": "EQUIPMENT_DIAGNOSTIC",
"schedule": {
"stop": {
"delayed": 120000
}
},
"parameters": {
"type": "HARDWARE"
},
"target": {
"append": {
"entities": [
"649843"
]
}
},
"active": true
}
}
}'
Receiving operation request into a device
You must be connected to OpenGate MQTT connector as a subscriber to topic odm/request/your-device-id,
if so, then you’ll receive an operation request like this:
{
"operation" : {
"request" : {
"timestamp" : 1614238879802 ,
"name" : "EQUIPMENT_DIAGNOSTIC" ,
"parameters" : {
"type" : "HARDWARE"
},
"id" : "14502149-99f9-4348-93f1-23aea495811b"
}
}
}
Answering the operation
Your device must publish a message to the topic odm/response/your-device-id to let OpenGate know it’s going to answer the operation:
{
"operation" : {
"response" : {
"name" : "EQUIPMENT_DIAGNOSTIC" ,
"timestamp" : 1614238881241 ,
"resultDescription" : "Success" ,
"steps" : [
{
"timestamp" : 1614238881241 ,
"description" : "System is OK" ,
"name" : "EQUIPMENT_DIAGNOSTIC" ,
"result" : "SUCCESSFUL"
}
],
"deviceId" : "649843" ,
"resultCode" : "SUCCESSFUL" ,
"id" : "14502149-99f9-4348-93f1-23aea495811b"
}
},
"version" : "1.0"
}