WebThingsIO / api

Web Thing API Specification
http://iot.mozilla.org/wot/
Other
164 stars 25 forks source link

Should there be an actions queue per Thing or per Action? #66

Closed benfrancis closed 6 years ago

benfrancis commented 6 years ago

Option 1

There is a single action queue for a Thing defined in the links member of the Thing Description:

"links": {
   "actions": "/things/pi/actions"
}

Action requests are posted to the actions resource which is a queue of all action requests on the Thing:

/things/pi/actions/123e4567-e89b-12d3-a456-426655

Option 2

Each action has its own URL, defined in the actions member of the thing description:

  "actions": {
    "reboot": {
      "name": "Reboot",
      "description": "Reboot the device"
      "href": "/things/pi/actions/reboot"
    }

Each action resource is a queue of action requests which you POST requests to: /things/pi/actions/reboot/123e4567-e89b-12d3-a456-426655

We could try implementing both, but then the URL namespaces used above would conflict.

benfrancis commented 6 years ago

Actually there are strategies implementers could use to avoid URL conflicts, like including the action name in the URL

GET all action requests or POST to request an action of any type: /things/pi/actions/

GET all reboot action requests or POST to request a reboot action: /things/pi/actions/reboot/

GET a or DELETE a specific reboot request: /things/pi/actions/reboot/123e4567-e89b-12d3-a456-426655

benfrancis commented 6 years ago

Closed by https://github.com/mozilla-iot/wot/commit/1265a1f6f83eaa1d770cc176de369f0955ad13b5