Ex. Web Service Stack
http://www.example.com/somepath/hello.cshtml
<!doctype html>
<head>
<title>C# Loop</title>
</head>
<html>
<body>
@for(var i = 0; i < 10; i++)
{<p>No @i</p>@}
</body>
</html> RFC 7230 (pg 7)
“The Hypertext Transfer Protocol (HTTP) is a stateless application- level request/response protocol that uses extensible semantics and self-descriptive message payloads for flexible interaction with network-based hypertext information systems.”
; HTTP/1.1 grammar
HTTP-message = start-line
*( header-field CRLF )
CRLF
[ message-body ]
start-line = request-line / status-line
request-line = method SP request-target SP HTTP-version CRLF
status-line = HTTP-version SP status-code SP reason-phrase CRLF
header-field = field-name ":" OWS field-value OWS
message-body = *OCTET
start-line examples
request-line = GET /~morganb/index.html HTTP/1.1 CRLF status-line = HTTP/1.1 304 Not Modified CRLF request-line = GET /~morganb/bad.html HTTP/1.1 CRLF status-line = HTTP/1.1 404 Not Found CRLF
+---------+-------------------------------------------------+-------+ | Method | Description | Sec. | +---------+-------------------------------------------------+-------+ | GET | Transfer a current representation of the target | 4.3.1 | | | resource. | | | HEAD | Same as GET, but only transfer the status line | 4.3.2 | | | and header section. | | | POST | Perform resource-specific processing on the | 4.3.3 | | | request payload. | | | PUT | Replace all current representations of the | 4.3.4 | | | target resource with the request payload. | | | DELETE | Remove all current representations of the | 4.3.5 | | | target resource. | | | CONNECT | Establish a tunnel to the server identified by | 4.3.6 | | | the target resource. | | | OPTIONS | Describe the communication options for the | 4.3.7 | | | target resource. | | | TRACE | Perform a message loop-back test along the path | 4.3.8 | | | to the target resource. | | +---------+-------------------------------------------------+-------+
Common Codes
+------+-------------------------------+--------------------------+ | Code | Reason-Phrase | Defined in... | +------+-------------------------------+--------------------------+ | 200 | OK | Section 6.3.1 | | 304 | Not Modified | Section 4.1 of [RFC7232] | | 400 | Bad Request | Section 6.5.1 | | 403 | Forbidden | Section 6.5.3 | | 404 | Not Found | Section 6.5.4 | | 500 | Internal Server Error | Section 6.6.1 | | 503 | Service Unavailable | Section 6.6.4 | +------+-------------------------------+--------------------------+
“A client sends request header fields to provide more information about the request context, make the request conditional based on the target resource state, suggest preferred formats for the response, supply authentication credentials, or modify the expected request processing. These fields act as request modifiers, similar to the parameters on a programming language method invocation.”
“The response header fields allow the server to pass additional information about the response beyond what is placed in the status-line. These header fields give information about the server, about further access to the target resource, or about related resources.”
“Request methods can be defined as "cacheable" to indicate that responses to them are allowed to be stored for future reuse ... this specification defines GET, HEAD, and POST as cacheable, although the overwhelming majority of cache implementations only support GET and HEAD”
GET HEAD OPTIONS TRACE
“Request methods are considered "safe" if their defined semantics are essentially read-only; i.e., the client does not request, and does not expect, any state change on the origin server as a result of applying a safe method to a target resource. Likewise, reasonable use of a safe method is not expected to cause any harm, loss of property, or unusual burden on the origin server.”
PUT DELETE GET HEAD OPTIONS TRACE
“A request method is considered "idempotent" if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request.”
Details and specifics will come later
“The name 'representational state transfer' is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through the application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.”