universAAL / remote

Remote Interoperability Managers that interconnect universAAL across networks
2 stars 1 forks source link

Poll: REST API: 409 vs 200 when POSTing existing resource #498

Closed Alfiva closed 4 years ago

Alfiva commented 6 years ago

What is the right HTTP code to return when POSTing a resource (e.g. a Context Susbcriber) to the REST API but it already exists?

According to the RESTful best practices I could find, it is suggested to return 409 (Conflict). But 409 seems also oriented to PUT conflicts in version-tracked resources. Others suggest using 422 (Unprocessable entity), and some popular implementations resort to simply saying 200 (OK), thus making POST kinda-idempotent, but enabling clients to be more carefree.

Currently (4.3.2-S) our REST API returns 409, but I have already seen some clients struggle with this (of course it can be fixed by just ignoring 409 when POSTing).

What do you think?