[API][v3] Inconsistency in HTTP Response code 200 vs 201 for GET vs POST/PATCH

3 posts • viewed 30 times

This message aims at: reporting a bug

Status: Solved
Upvotes: 0
Downvotes: 0
It looks like in all of the GET operations, a 200 is returned to indicate 'query success'.

On POST for /types a 201 is returned to indicate the operation was a success.
On POST/PATCH for /users a 200 is returned to signify the same.

201 Should likely be used for the POST endpoints, and while 201 is fine for PATCH, 202 may be more appropriate.
Hi, thank you for the feedback!

I changed the success response code for POST /users/{user_id}/collected_items from 200 to 201.

The PATCH operation doesn't create any new resource, and the change is already done when sending the response, so the codes 201 and 202 do not fit. I'll keep 200.
Status changed to Solved (Xavier, 30-Mar-2022, 08:40 pm)
Thank you!

Used time zone is UTC+2:00.
Current time is 09:27 pm.