Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Mihini/REST API"
< Mihini
m |
|||
Line 1: | Line 1: | ||
− | This page describes the current status of the Mihini REST service | + | This page describes the current status of the Mihini agent REST service. The Mihini agent REST exposes agent services by a REST API. |
− | == Specifications == | + | == Specifications == |
− | === Returned values === | + | === Returned values === |
− | Each REST function returns the same value as the function to which it corresponds, except that it is serialized with JSON | + | Each REST function returns the same value as the function to which it corresponds, except that it is serialized with JSON |
− | == API == | + | == API == |
− | See below a list of the current Lua API with their corresponding REST API | + | See below a list of the current Lua API with their corresponding REST API |
− | === Devicetree === | + | === Devicetree === |
{| border="1" cellspacing="0" cellpadding="5" | {| border="1" cellspacing="0" cellpadding="5" | ||
|- | |- | ||
− | ! Module API | + | ! Module API |
− | ! REST URL | + | ! REST URL |
− | ! HTTP method | + | ! HTTP method |
! HTTP payload | ! HTTP payload | ||
− | |- | + | |- |
− | | devicetree.get("node.subnode.leaf") | + | | devicetree.get("node.subnode.leaf") |
− | | devicetree/node/subnode/leaf | + | | devicetree/node/subnode/leaf |
− | | GET | + | | GET |
| Nothing | | Nothing | ||
|- | |- | ||
− | | devicetree.set("node.subnode.leaf", "myvalue") | + | | devicetree.set("node.subnode.leaf", "myvalue") |
− | | devicetree/node/subnode/leaf | + | | devicetree/node/subnode/leaf |
− | | PUT | + | | PUT |
| The new value of "node.subnode.leaf" serialiazed with JSON | | The new value of "node.subnode.leaf" serialiazed with JSON | ||
|} | |} | ||
Line 41: | Line 41: | ||
|- | |- | ||
| appcon.list() | | appcon.list() | ||
− | | application | + | | application |
| GET | | GET | ||
| Nothing | | Nothing | ||
Line 53: | Line 53: | ||
| application/id/start | | application/id/start | ||
| PUT | | PUT | ||
− | | | + | | Empty JSON Payload ({ })<br> |
|- | |- | ||
| appcon.stop("id") | | appcon.stop("id") | ||
| application/id/stop | | application/id/stop | ||
| PUT | | PUT | ||
− | | | + | | Empty JSON Payload ({ }) |
|- | |- | ||
| appcon.configure("id", autostart) | | appcon.configure("id", autostart) | ||
Line 66: | Line 66: | ||
|} | |} | ||
− | === Update === | + | === Update === |
{| border="1" cellspacing="0" cellpadding="5" | {| border="1" cellspacing="0" cellpadding="5" | ||
|- | |- | ||
− | ! Module API | + | ! Module API |
− | ! REST URL | + | ! REST URL |
− | ! URL parameter | + | ! URL parameter |
− | ! HTTP method | + | ! HTTP method |
! HTTP payload | ! HTTP payload | ||
− | |- | + | |- |
− | | update.localupdate(path, sync) | + | | update.localupdate(path, sync) |
− | | update/ | + | | update/ |
− | | sync=[0-1] (optional, asynchronous by default) | + | | sync=[0-1] (optional, asynchronous by default) |
− | | POST | + | | POST |
| The tar archive sent as binary data in a http chunked request | | The tar archive sent as binary data in a http chunked request | ||
|- | |- | ||
− | | update.getstatus() | + | | update.getstatus() |
− | | update/ | + | | update/ |
− | | sync=[0-1] (optional, asynchronous by default) | + | | sync=[0-1] (optional, asynchronous by default) |
− | | GET | + | | GET |
| Nothing | | Nothing | ||
|} | |} | ||
− | == Configuration == | + | == Configuration == |
− | Everything is configurable in the config store | + | Everything is configurable in the config store |
− | === defaultconfig.lua === | + | === defaultconfig.lua === |
− | <pre style="width: 45em;"> | + | <pre style="width: 45em;">-- REST related settings |
− | -- REST related settings | + | |
rest = {} | rest = {} | ||
rest.activate = true | rest.activate = true | ||
rest.port = 8357 | rest.port = 8357 | ||
− | </pre> | + | </pre> |
− | + | === Lua shell === | |
− | === Lua shell === | + | <pre style="width: 45em;">$ telnet localhost 2000 |
− | <pre style="width: 45em;"> | + | > :agent.config.rest.activate |
− | $ telnet localhost 2000 | + | |
− | + | ||
true | true | ||
− | + | > :agent.config.rest.port | |
8357 | 8357 | ||
− | </pre> | + | </pre> |
− | + | == Suggestions == | |
− | == Suggestions == | + | |
Feel free to send your feedbacks on the Mihini mailing list, suggestions for improvements are always welcome | Feel free to send your feedbacks on the Mihini mailing list, suggestions for improvements are always welcome |
Revision as of 06:14, 5 August 2013
This page describes the current status of the Mihini agent REST service. The Mihini agent REST exposes agent services by a REST API.
Contents
Specifications
Returned values
Each REST function returns the same value as the function to which it corresponds, except that it is serialized with JSON
API
See below a list of the current Lua API with their corresponding REST API
Devicetree
Module API | REST URL | HTTP method | HTTP payload |
---|---|---|---|
devicetree.get("node.subnode.leaf") | devicetree/node/subnode/leaf | GET | Nothing |
devicetree.set("node.subnode.leaf", "myvalue") | devicetree/node/subnode/leaf | PUT | The new value of "node.subnode.leaf" serialiazed with JSON |
Application container
Module API | REST URL | HTTP method | HTTP payload |
---|---|---|---|
appcon.list() | application | GET | Nothing |
appcon.status("id") | application/id | GET | Nothing |
appcon.start("id") | application/id/start | PUT | Empty JSON Payload ({ }) |
appcon.stop("id") | application/id/stop | PUT | Empty JSON Payload ({ }) |
appcon.configure("id", autostart) | application/id/configure | PUT | A boolean value corresponding to "autostart" and serialized with JSON |
Update
Module API | REST URL | URL parameter | HTTP method | HTTP payload |
---|---|---|---|---|
update.localupdate(path, sync) | update/ | sync=[0-1] (optional, asynchronous by default) | POST | The tar archive sent as binary data in a http chunked request |
update.getstatus() | update/ | sync=[0-1] (optional, asynchronous by default) | GET | Nothing |
Configuration
Everything is configurable in the config store
defaultconfig.lua
-- REST related settings rest = {} rest.activate = true rest.port = 8357
Lua shell
$ telnet localhost 2000 > :agent.config.rest.activate true > :agent.config.rest.port 8357
Suggestions
Feel free to send your feedbacks on the Mihini mailing list, suggestions for improvements are always welcome