Figure 7-9 Syntax of a POST Request
POST: The keyword POST must be all uppercase.
Request URI: Specifies the path of the resource requested, which
must begin from the root / of the document base directory.
HTTP version: Either HTTP/1.0 or HTTP/1.1. This client negotiates
the protocol to be used for the current session. For example, the client
may request to use HTTP/1.1. If the server does not support HTTP/1.1,
it may inform the client in the response to use HTTP/1.0.
Request headers (optional): The client can use optional request
headers, such as content type and content length to inform the server of
the media type and the length of the request body, respectively.
Request body (optional): A POST request message has an optional
request body, which contains the query string (explained later in this
chapter).
HTTP Headers
The HTTP headers and parameters provide of a lot of
information that can help you trace issues when you
encounter them. HTTP headers are an essential part of
an API request and response as they represent the
metadata associated with the API request and response.
Headers carry information for the following:
Request and response body
Request authorization
Response caching
Response cookies