openlibraryenvironment/gokb

Response of successful POST/PATCH/PUT

Closed this issue · 4 comments

The response of a successful POST, PATCH or PUT should not contain result and message, its redundant because the status 200 says everything.

the successful POST returns a 201 response status and the newly created object as data, according to the best practices. Beside that, the guide suggests to return the new (or changed) entity so the client does not need to GET it again, to use the new data.
https://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#restful

Yes but also result and message is delivered:

message: "User profile sucessfully created."
result: "OK"

these fields are deprecated and subject to deletion, as we need no other result status field than the response status and the message is otherwise exclusively used in errors.

wonderful