Readings: HTTP and REST
-
The Hyper Text Transfer Protocol
(HTTP)
is a stateless request-response application layer protocol. -
HTTP is often associated with serving .html files but is also used to transfer images, videos, .json, .xml, binary executables, and much more.
-
A HTTP/1.1 request is formatted in text and transferred using TCP. The first line of the request contains the METHOD, URL, and HTTP VERSION.
-
A HTTP/1.1 response is also formatted in text and transferred using TCP. The first line of the response contains the HTTP VERSION, STATUS CODE, and STATUS MESSAGE.
-
REST is acronym for REpresentational State Transfer. In layman’s terms, is a means by which we can reference, manipulate, and transfer state. Rest uses a common set of methods
(called “verbs”)
to operate on the state of a resource(“noun”)
, generally using HTTP as the transfer protocol. -
A “RESTful Endpoint” is a URI that identifies the resource. When addressed with a proper method, you are able to effect state. In normal terms, this means “Performing CRUD operations over HTTP”.
REST Method | CRUD Operation | Function |
---|---|---|
GET | READ | Retrieve 1 or More Records |
POST | CREATE | Create a new record |
PUT | UPDATE | Update a record through replacement (Put it back) |
PATCH | UPDATE | Update a record (just the parts that changed) |
DESTROY | DELETE\Remove a record |