The Internet is vast, but it mostly amounts to resources hosted on servers. These resources are accessed via HTTP (Hyper Text Transfer Protocol), which provides an agreed-upon language for requests and responses. A message sent by the client to the server is known as an HTTP request. Clients can use different methods of interacting with servers, which are called HTTP request methods. These are always upper case verbs, and tell the server what we want to do.
A GET request reads information from a record in the database. Typing `curl https://jsonplaceholder.typicode.com/posts` and ENTER in your terminal should return a status code and content that looks like this:
So, what happened in this GET request? The client (us) requested information from the API at `https://jsonplaceholder.typicode.com`, specifically the endpoint at `/posts`, by sending a JSON card with a GET request to the API. The API authenticated the request and made a call to the server. The server returned the requested information to the API, and the API sent the JSON card with the requested information back to the client (us).
Try some of the other most common HTTP request methods in your terminal with cURL:
Note that we're using JSON Placeholder to test their API endpoints. Thanks for this great resource!
The above HTTP request methods are not all of the possible methods. There are a[few others to keep in mind that are useful in testing and debugging:
HTTP requests are how clients modify resources via APIs. Knowing how to use these requests effectively allows you to access any API you have authorization for. Just as authors use the same language we do to write incredible books, Google Maps is made with these same fundamental components of HTTP request methods. With a little practice, you'll do great things, too.