Sending a Request to a Server
When you want to retrieve data from a web server, you send a GET request to the server. When sending a request, the URL will contain the information on the resource you want data from. The URL can be broken down into a few key parts. These include the protocol, the hostname, the URI, and the query parameters. The format of it looks like this:
In this example:
- The
Protocol
tells the client how to connect to the server. The two most common protocols are HTTP and HTTPS. In this example, we have usedhttps
. - The
Hostname
is the address of the server we want to connect to. In this example, it isexample.com
. - The
URI
is the Uniform Resource Identifier (URI), and this tells the server the path to the resource we want. In this example, it is/downloads
. - The
Query Parameters
tell the server of any additional information it needs. In this example, we have two parameters. These arefilter...