Instructions
Create an Instruction
POSThttps://api.hivekit.io/v2/realm/[realmId]/instruction/[instructionId]
Create a new instruction and run it immediatly. The instruction code itself is contained in the instruction
parameter.
Request Body
{
"label": "Set status for low battery",
"instruction": "when
object(type=\"scooter\", charge<0.2)
then
set(\"status\", \"needs-charging\")",
"data": { // optional
"createdBy": "John Doe"
}
}
Response Body
{
"id": "instruction-a",
"result": "success"
}
Update an Instruction
PATCHhttps://api.hivekit.io/v2/realm/[realmId]/instruction/[instructionId]
Updates an existing instruction. You can change the label, instruction code and data of an instruction individually. Providing new instruction code will stop the old version of the instruction and start the new one. New data properties will be merged into existing ones, so if your instruction's current data is {"firstname": "Homer"}
and you update it with {"lastname": "Simpson"}
, the resulting data will be {"firstname": "Homer", "lastname": "Simpson"}
. To remove a property, set it to null
.
Request Body
{
"label": "Set status for low battery",// optional
"instruction": "when // optional
object(type=\"scooter\", charge<0.2)
then
set(\"status\", \"needs-charging\")",
"data": { // optional
"createdBy": "John Doe"
}
}
Response Body
{
"id": "instruction-a",
"result": "success"
}
Read an Instruction
GEThttps://api.hivekit.io/v2/realm/[realmId]/instruction/[instructionId]
Response Body
{
"id": "instruction-a",
"label": "Set status for low battery",
"instruction": "when
object(type=\"scooter\", charge<0.2)
then
set(\"status\", \"needs-charging\")",
"data": {
"createdBy": "John Doe"
}
}
List Instructions
GEThttps://api.hivekit.io/v2/realm/[realmId]/instruction
Response body
{
"instruction-a": {
"id": "instruction-a",
"label": "Instruction A",
"data": {
"createdBy": "John Doe",
"updatedBy": "Jane Doe"
}
},
"instruction-b": {
"id": "instruction-b",
"label": "Instruction B",
"data": {
"createdBy": "John Doe"
}
}
}
Delete an Instruction
DELETEhttps://api.hivekit.io/v2/realm/[realmId]/instruction/[instructionId]
Response Body
{
"id": "instruction-a",
"result": "success"
}