Sending Data with a GET Request

In a GET request, additional data related to your requested resource is passed as a query string in the URI.

telnet httpbin.org 80
Connected...
GET /get?firstname=Chris&language=English HTTP/1.1
Host: httpbin.org

Query String
/get?firstname=Chris&language=English
Requesting the resource at /get, passing a first name and a language. This is called a query string. It is a string of name-value pairs separated by &, and started with a ? question mark.

q
You can simulate a GET request with sent data in your browser by typing things like
stackoverflow.com/search?q=http OR google.com/maps?q=chicago.

Those q parameters in the queries string are passed in GET request. GET requests with data appended in the URI are read-only, they do not make any changes to the resource – unlike a POST request – and only return existing data.


Sending Data with a POST Request

Data is included in the payload (i.e. request body), after a blank line that follows the headers.

telnet httpbin.org 80
Connected...
POST /post HTTP/1.1
Host: httpbin.org
Content-Length: 32

firstname=Chris&language=English
 

Content-Length: 32
A header indicating the number of bytes of our data in the payload. The size of the data and the Content-Length header value must match! Otherwise, the server’s response will not be 200/OK, instead it will be a Bad Request 400.

firstname=Chris&language=English
The data in POST requests are sent in the payloads.