Basic queries
Get a list of automation scenarios
Query:
GET /api/v1/automatons
Answer:
An array of all automation scripts in the project, including the following information about automatons:
- identifier;
- name;
- description;
- selected models
Get information about one automation scenario
Request:
GET /api/v1/automatons/:id
Answer:
Automation script representation in JSON format, including
- identifier;
- name;
- description;
- selected models;
- information about the constructed states and transitions
Create a new automation scenario
In the body of the request to create a new automation scenario, specify its representation in JSON format.
Required fields:
- model - model identifier;
- name - name of the new automation scenario.
Request:
POST /api/v1/automatons
{
"model": "<model-id>",
"name": "test-automaton-01",
"description": "Automaton for sensor"
}
Answer:
Presentation of automation script in JSON format
Change automation script
In the body of the request to modify an existing automation script, specify the fields to be updated. fields to be updated.
Request:
PATCH /api/v1/automatons/:id
{
"name": "test-automaton-02"
}
Answer:
Presenting the automation script in JSON format, taking into account the modified fields
Delete automation script
Request:
DELETE /api/v1/automatons/:id
Answer:
JSON representation of a remote automation script
Executing automation scripts on objects
Important: In requests, :id
is the identifier of the object on which you want to run the automaton.
to run the automaton, :automaton
is the identifier of the automaton to be run. |
Start automation script execution on the object
Request:
POST /api/v1/objects/:id/automatons/:automaton/start
Answer:
Information about the status and state of automaton execution at the moment of its start in JSON format
Stop automation script execution on the object
Request:
POST /api/v1/objects/:id/automatons/:automaton/stop
Answer:
Information about the status and execution state of the automaton at the moment of its stop in JSON format
Send event to running automation script
In the body of the request specify the identifier of the event that should be to generate in the automatism.
Required fields:
- event - event identifier.
Request:
POST /api/v1/objects/:id/automatons/:automaton/emit
{
"event": "<event-id>"
}
Answer:
Information about the status of request execution
Tip: This request is analogous to pressing the button. Generate event in an automaton running on the object.