WebThingsIO / api

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

Define Action, Event, Properties and ActionRequest resources. Closes #34, #35 and #36 #100

Closed benfrancis closed 6 years ago

benfrancis commented 6 years ago

I've made an attempt to define separate Action, Event and Properties resources as discussed in #82.

I've realised that's there's also technically a separate ActionRequest resource for an individual action request (vs. the Action resource which is a queue of requests for a single action, the Event resource is an event log for a particular event).

This leaves us with separate Properties/Property, Actions/Action/ActionRequest and Events/Event resources and defines where the URLs for each of these resources can be defined.

There are few quirks here (like the separate ActionRequest resource), so feedback is welcome.

You can see a live version at https://benfrancis.github.io/wot/

mrstegeman commented 6 years ago

I think if we don't want the POST to be redundant, it should be specified that:

  1. Only actions for that name are accepted, and/or
  2. The extra name: {} wrapper need not be included when doing POST /actions/name

Alternatively, we could just get rid of one of the POST requests.

benfrancis commented 6 years ago

I've addressed the review comments.

Only actions for that name are accepted, and/or

I went for this option to try to keep some consistency between HTTP requests and with the WebSocket API which always specifies an action type in an action request.

If another action type is requested, the server should respond with 400 Bad Request.

mrstegeman commented 6 years ago

@benfrancis That sounds good. I still had the one comment about the missing timeCompleted, but otherwise I'm fine with this.

benfrancis commented 6 years ago

Yep I fixed that one too (once I'd figured out which branch I was meant to be pushing to!)