EN

Basic queries

Get list of objects

Query:
GET /api/v1/objects
Answer:
Array of all project objects

Get information about one object

Request:
GET /api/v1/objects/:id
Answer:
Representation of an object in JSON format

Create a new object

In the body of the request to create a new object, specify its representation in JSON format. JSON format.
Required fields:
  • model - model identifier;
  • id - object identifier for device connection;
  • name - name of the new object.
Request:
POST /api/v1/objects
{
  "model": "<model-id>",
  "id": "test-object-01",
  "name": "test-object-01"
}
Answer:
Representation of an object in JSON format

Modify object

In the body of a request to modify an existing object, specify the fields you want to update. should be updated.
Request:
PATCH /api/v1/objects/:id
{
  "name": "test-object-02",
  "status": "broken"
}
Answer:
Representation of an object in JSON format taking into account changed fields

Delete object

Request:
DELETE /api/v1/objects/:id
Answer:
JSON representation of a remote object

Get packet history

Query:
GET /api/v1/objects/:id/packets
Answer:
Array of all packets of an object
To request a list of packets received during a certain period, specify the lower and upper bounds of the interval in the from and to parameters, respectively. interval in the from and to parameters, respectively. Interval boundaries are specified as specific points in time in one of the formats:
  1. Unix time - number of milliseconds since midnight (00:00:00 UTC) on January 1, 1970;
  2. ISO 8601 - date and time in the format YYYYY-MM-DDThh:mm.
For example, requests
  • /api/v1/objects/:id/packets?from=1640131200000&to=1640563200000
  • /api/v1/objects/:id/packets?from=2021-12-22T00:00&to=2021-12-27T00:00
allows you to download a list of packets received between December 22 and December 27, 2021. December 22 through December 27, 2021.

Object Commands

💡
Important: In queries, :id is the identifier of the object to which the command; :command is the identifier of the command in the model.

Send command

Request:
POST /api/v1/objects/:id/commands/:command
Response:
Response from the device in JSON format

Send command with parameters

There are commands with parameters, the value of which can be specified directly when sending them. This is necessary if the user does not knows in advance the values to be sent in the command, or these values may change from time to time.
Example:
In this case, in the body of the request to send the command to the object, specify the necessary parameters in JSON format.
Request for the command from the example:
POST /api/v1/objects/:id/commands/new_command
{
  "state_param": 42
}
Answer:
Response from the device in JSON format