WebThingsIO / api

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

Cancel Action: allow Thing to reject #55

Open coderbyheart opened 6 years ago

coderbyheart commented 6 years ago

It may be that an action cannot be canceled since it might be already "in flight" or the Thing is otherwise unable to cancel the action (e.g. because it currently does not have enough resources).

In that case the Thing should be allowed to return the appropriate error code, which would be either 403 Forbidden or 503 Service Unavailable.

benfrancis commented 6 years ago

Yes, good idea. The API could respond with an error code like you say.

benfrancis commented 6 years ago

Note: currently our implementation sends a 404 if it fails to DELETE an action request, but we could try to be more specific https://github.com/mozilla-iot/gateway/blob/master/src/controllers/actions_controller.js#L88