Basic queries
Get a list of basic models
Request:
GET /api/v1/models/base
Answer:
Array of base models available for use
Get list of models
Query:
GET /api/v1/models
Answer:
Array of all models in the project
Get information about one model
Query:
GET /api/v1/models/:id
Answer:
Representation of a model in JSON format
Create a new model
In the body of the request to create a new model, specify its representation in JSON format. JSON format.
Required fields:
- base - base model identifier;
- name - name of the new model.
Request:
POST /api/v1/models
{
"base": "mqtt",
"name": "test-model-01",
"description": "Model of microcontroller"
}
Answer:
Change the model
In the body of the request to modify an existing model, specify the fields that you want to update.
Request:
PATCH /api/v1/models/:id
{
"name": "test-model-02",
"description": "Model of sensor"
}
Answer:
Representation of the model in JSON format taking into account changed fields
Delete model
Request:
DELETE /api/v1/models/:id
Answer:
JSON representation of a remote model
Model Nodes
Important: In queries, :id
is the identifier of the model; :node
is the identifier of the model node.
of the model node.
Create a new node
In the body of the request to create a node, specify information about the node in JSON format.
Required fields:
Request:
POST /models/:id/nodes
{
"id": "floorTemperature",
"type": "argument",
"name": "Floor Temperature",
"unit": "temperature-celsius",
"dataType": "number"
}
Answer:
Change node
In the body of the request to modify an existing node, specify the fields, fields to be updated.
Request:
PATCH /models/:id/nodes/:node
{
"name": "Floor Temperature (in Fahrenheits)",
"unit": "temperature-fahrenheit"
}
Answer:
Representation of a node in JSON format taking into account changed fields
Delete node
Request:
DELETE /api/v1/models/:id/nodes/:node
Answer:
JSON representation of a remote node