Tutorial by Examples

Not everyone agrees on what the most semantically correct method for resource creation is. Thus, your API could accept POST or PUT requests, or either. The server should respond with 201 Created if the resource was successfully created. Pick the most appropriate error code if it was not. For examp...
Editing or updating a resource is a common purpose for APIs. Edits can be achieved by sending either POST, PUT or PATCH requests to the respective resource. Although POST is allowed to append data to a resource's existing representation it is recommended to use either PUT or PATCH as they convey a m...
Another common use of HTTP APIs is to delete an existing resource. This should usually be done using DELETE requests. If the deletion was successful, the server should return 200 OK; an appropriate error code if it was not. If our employee Charlie Smith has left the company and we now want to dele...
The last common use of HTTP APIs is to obtain a list of existing resources on the server. Lists like this should be obtained using GET requests, since they only retrieve data. The server should return 200 OK if it can supply the list, or an appropriate error code if not. Listing our employees, the...

Page 1 of 1