EN

Handlers

Basic queries

Get list of handlers

Request:

GET /api/v1/handlers

Answer:

Array of all project handlers

Get information about one handler

Request:

GET /api/v1/handlers/:id

Answer:

Handler representation in JSON format

Create a new handler

In the body of the request to create a new handler, specify its representation in JSON format. in JSON format.

Required fields:

  • name - name of the new handler;

  • userCode - handler code.

Request:

POST /api/v1/handlers

{
  "name": "test-handler-01",
  "userCode": "function process(a, b) { return { sum: a + b } }"
}

Answer:

Handler representation in JSON format

Edit handler

In the body of the request to modify an existing handler, specify the fields, that need to be updated.

Request:

PATCH /api/v1/handlers/:id

{
  "name": "test-handler-02",
  "description": "Handler for sensor"
}

Answer:

Presentation of the handler in JSON format with modified fields

Delete handler

Request:

DELETE /api/v1/handlers/:id

Answer:

JSON representation of the remote handler

Executing handlers on objects

💡

Important: In requests, :id is the identifier of the object on which you want to handler, :handler is the identifier of the handler to be run. |

Start handler execution on object

Request:

POST /api/v1/objects/:id/handlers/:handler/start

Answer:

Information about the status of the request execution

Stop execution of handler on object

Request:

POST /api/v1/objects/:id/handlers/:handler/stop

Answer:

Information about the status of the request execution