HTTP Methods for RESTful Services
The common HTTP methods! GET, POST, PUT, PATCH and DELETE
Prerequisites:
- None
Terminology
The methods:
DELETE: delete a resource identified by a URI
GET: requests data from a specified endpoint
PATCH: used to modify resources
POST: sends data to a specified endpoint to create or update a resource
PUT: used to update resources
Others:
Idempotent: An operation that produces the same results if executed multiple times
JSON: JavaScript Object Notation, a lightweight format for storing and transporting data
URI: Uniform Resource Identifier
The HTTP Verbs
POST
We can think of POST as a way to create new resources.
Creating
Typically the resources that are created are subordinate resources; that we POST
to the parent and the service associates the new resource to the parent.
On Success
We should expect a HTTP status of 201 to be returned, including a link to the newly created resource.