-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
This describes how to use the server to add models and associate them with devices.
A model is uniquely identified by its name and version. Every uploaded model should have both the fields. They also have 2 other fields active
and archive
. For a model with a particular name, you can have multiple you can only have one model marked as active
. This field decides the model the client chooses to use at runtime. The archive
field can be used for models that can be deprecated and are not needed now. Once a model is marked as archived, it won't be downloaded by the client.
curl -F "file=@src/main/resources/barometer-model.model" 'localhost:9979/maori-server/model?name=barometer&version=v2'
This API simply uploads a model to the server. It won't get downloaded to the client unless it is associated with a device. By default all models are in an active state.
curl -X POST 'localhost:9979/maori-server/model/device/associate?name=barometer&version=v2&deviceId=d1'
One model can be linked to multiple devices.
curl -X PUT 'localhost:9979/maori-server/model/activate?name=barometer&version=v2&active=true'
curl -X PUT 'localhost:9979/maori-server/model/activate?name=barometer&version=v2&archive=true'
curl -X GET 'localhost:9979/maori-server/model?name=barometer&version=v1'
Returns the binary serialized model in Base64 encoded format.
curl -X GET 'localhost:9979/maori-server/model/info?deviceID=dev1'
Returns a JSON string representing all the models stored for a particular device.
{
result: [
{ name: "barometer", version: "version1", active="true" },
{ name: "barometer", version: "version2", active="false" },
{ name: "accelerometer", version: "version1", active="true" },
]
}