WebThingsIO/webthing-node

Server returns status of 201 Created when action fails to validate input.

Closed this issue · 4 comments

The server returns a response code of 201 Created for an action request when validation fails on the input. No action is actually created. Expected some form of error code (e.g. 400) with an error response indicating why the input failed validation.

You should see an error in the data returned if you GET the action resources after that. Our spec is not fully clear on what should happen in this case.

I noticed that about the Web Thing API. After a POST action failure (with invalid input), I performed an 'actions' GET request and received an empty array. Is this the correct call to get the error status you refer to?

Ah, I understand what's happening now. The action request is being rejected, but the spec is unclear regarding whether or not multiple actions can be created by a single POST request. However, it seems silly to support that. I'll have a fix up shortly.

Thank you, this change solved the problem I was seeing. :-)