til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

Notes on RESTful API Design

This is a list of return codes in relation to a RESTful API design.

Some of the operations has more that one outcome, so you need to decide on what you find the most appropriate one.

</td> </table>
OperationHTTP MethodSTATUS CODE ON SUCCESSNotes
CreatePOST201 CreatedWhen the object is created immediately
202 AcceptedWhen the object is accepted but not created immediately</td</tr>
ReadGET200 OKWhen the object requested in included in the response
UpdatePUT200 OKWhen the updated object is returned as part of the response
204 No ContentWhen the updated object is not returned as part of the response
PATCH200 OKWhen the updated object is returned as part of the response
204 No ContentWhen the updated object is not returned as part of the response
DeleteDELETE200 OKWhen an object changes status to deleted or similar
202 AcceptedWhen an object changes status to deleted or similar and is deleted a part of a garbage collection process or similar
204 No ContentWhen an object is deleted immediately
</td>
OperationHTTP MethodSTATUS CODE ON ERROR
CreatePOST409 Conflict
422 Unprocessable Content
ReadGET404 Not Found
UpdatePUT404 Not Found
409 Conflict
PATCH404 Not Found
DeleteDELETE404 Not Found