Hold on, before you move to an API Gateway, let me walk you through what an API is! But if you are someone who does not wish to read that part, I would want to keep you in the present context. Hence, you can either continue to read, or check out my article on what is API.
What is an API Gateway?
An API gateway is essentially a reverse proxy , which accepts all the API calls from client(s), and re-directs them based on the routing protocols to the backend servers. They then aggregate the server’s response, and return the result to the client.
No, this is not it’s sole purpose – it’s commonly used by enterprises and startups, for other essential services! Let’s move on to read those, but first let’s read what a reverse proxy is.
What is a Reverse Proxy?
A proxy server is a server (virtual or physical) that acts as an intermediary for requests from clients seeking resources from servers that provide those resources.
The flow above depicts what a forward proxy is. It is a server that sits in front of the client. It ensures that any server or response from the internet doesn’t interact with the client directly. A classic example would be a client side VPN or virtual private network.
On the other hand, a reverse proxy is a server that sits in front of the web servers. It ensures that the clients don’t communicated directly with the origin servers. A classis example is CDN or content delivery network.
What does an API Gateway do?
An API gateway is an organized way to decouple the client interface from your backend implementation. When a client makes a request, the API gateway splits it into multiple requests, routes them appropriately. It then produces a response, and responds to the client, maintaining a track of everything.
- You can setup an authentication service to protect your APIs from abuse by malicious users
- It also features enabling and setting conditions for rate limiting on your APIs, to prevent overuse
- You can connect any of your monetized APIs to a billing system. This is helpful when your API calls generate revenue based on number of requests, for instance!
- You can also incorporate analytics and monitoring over the API calls, to understand how people use your APIs
- In case you have a microservice architecture, a single API request could implicitly request multiple calls to different applications. This can be handled well by an API gateway
I believe that the above few features that an API Gateway comes with, sums up it’s importance pretty well. Hope this article helps the reader in some way – the technical way!