Mondays have a tendency to be stressful, so on Mondays I like to cover a challenging development topic and give a dead simple explanation of how it works in the real world. Today I’m going to discuss how HTTP works, especially as it relates to developers working on building API and service based applications.
HTTP is an acronym that stands for Hypertext Transfer Protocol, and at a high level it’s the protocol that the Internet uses to connect users and servers throughout the world. You could probably spend your career learning all of the intricacies of how HTTP works, so I want to focus on the components that are important from a developer perspective.
The first key term is the HTTP request. This is what happens every time you go to a new page on a website. If you have made a search on Google you’ve made an HTTP request, it simply means that you’re sending information to a server. Once the server receives the information it has to decide on how to handle the request, which leads to the second key term: the response.
An HTTP response is what the server sends back to the client. The client can be a web browser, a mobile phone, or anything connected to the Internet.
For a basic workflow, when I search for cute puppies on Google, the term cute puppies is sent as the HTTP request, the Google servers take in the request, and then send back a list of cute puppy links as the response.
So how does that help you as a developer? Well, when you’re building service based applications you’ll be sending HTTP requests and receiving responses to fill your application with data.
Some development case studies would be:
In a mapping application you would send your API keys to Google, along with geo coordinates and be sent back a response containing mapping data so your users can see their location on an iPhone app.
For a shopping application you would send billing information to the Stripe API and receive a response back that lets your app know if the payment was made successfully or not.
Hopefully this gives you a high level understanding of how HTTP works and how you work with it in development, in the resources section of the post I’ve included links where you can deepen your knowledge of HTTP and how responses and requests are processed.
Resources for How HTTP Works