The Narrow Waist of the Internet

Learn about the layered architecture of the internet to better understand how APIs work.


APIs send requests and receive responses over a network. The internet opts for a layered approach to its architecture to manage the complexity of sending data across two entities, which could potentially be in two far-away parts of the world. Initially, the internet standardized the IP as a middleware around which all the innovation happens. We could make any application hoping that the IP would relay its data, and any new communication technology could flourish underneath the IP layer, provided it supports IP. However, many hiccups have happened over the years in the attempt to achieve that goal. Today, most public-facing API calls use HTTP. Let’s suppose we use a raw IP packet with our custom transmission protocol, something other than Transmission Control Protocol (TCP) or User Datagram Protocol (UDP). In that case, it probably won’t make it far, because most enterprises use firewalls that only allow a handful of well-known applications, and drop everything else. (Actually, such a packet might not pass through our ISP router!) Because this is a course on API design, our purpose here is to answer the following question from the first principles of networking:

  • Why does a large proportion of API calls converge to use REST over HTTPS?

We’ll first refresh the concepts of the layered architecture of the internet before describing insights to answer the question above.

Layered architecture

Let's assume that we have MM layered architecture, where each layer has a specific function. Any NthN^{th} layer in the MM layered architecture provides services to the Nth1N^{th} - 1 layer and gets services from the Nth+1N^{th} + 1 layer. Such a layered architecture has the following advantages:

  • Provides modularity so that each layer performs its own operations.

  • Provides ease in troubleshooting the network.

  • Modification in one layer has no impact on the other.

  • Flexibly accommodates different types of applications.

A layered approach divides the large task into smaller tasks, making it easy to solve the bigger problem. To communicate between any two systems sharing a network (for instance, client-server communication), the request is communicated from one layer to the next, where each layer performs its set of tasks.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.