Open hawkw opened 9 years ago
StackOverflow suggests either 409 Conflict
or the WebDAV extension 422 Unprocessable Entity
. Since we're already returning 409 Conflict
in the Loans API when creating loans that already exist, I'm thinking that might be the right choice.
Of course, there's also the option of using multiple POSTs to update an entry, but my understanding of HTTP verb semantics is that it's best to use PUT for that.
It's worth noting that Scalatra does have support for the PUT and DELETE verbs, and that there is a 422 ActionResult
. So those wouldn't take any extra work to do.
I'm going to just go ahead and decide to return 422. If @redbassett thinks this is incorrect or would prefer different behaviour, we can change it.
Fixed in 5b0e2166f34250ca0b8355e22e40522eb416eb03 and 3b6556e426474f64b981a6d647f2b18cc435fdcc on develop
.
What should the
POST /books/
andPOST /authors/
routes return when the entity POSTed already exists in the database?This should be added to the API spec.