Operations and status codes

The following is guidelines prescribing what HTTP method to use for common “business functions” and what status codes to return for the happy case. If a header is to be returned, an example is given.

FunctionHTTP MethodStatus CodeHeaderComment
ListGET /foos/200 OKCollection in response. 200 Ok even if empty collection
CreatePOST /foos/201 CreatedLocation: /foos/1234No body in response
GetGET /foos/1234200 OK
UpdatePUT /foos/1234204 No ContentNo body in response
Update (patch)PATCH /foos/1234200 OKThe updated resource in response body
DeleteDELETE /foos/1234204 No ContentNo body in response

References

Method definitions Status Code Definitions
JSON Patch