NGINX is now part of F5. See why we’re better together.
The API gateway takes all API requests from a client, determines which services are needed, and combines them into a synchronous experience for the user.
What Is an API Gateway?
An API gateway takes all API calls from clients, then routes them to the appropriate microservice with request routing, composition, and protocol translation. Typically it handles a request by invoking multiple microservices and aggregating the results, to determine the best path. It can translate between web protocols and web‑unfriendly protocols that are used internally.
An ecommerce site might use an API gateway to provide mobile clients with an endpoint for retrieving all product details with a single request. It invokes various services, like product info and reviews, and combines the results.
Videos on API Gateways
Building Microservices Using an API Gateway
For most microservices‑based applications, it makes sense to implement an API gateway, because it acts as a single entry point into a system. The API gateway is responsible for request routing, composition, and protocol translation, and can streamline the system. With an API gateway, each of the application’s clients gets a custom API. It handles some requests by simply routing them to the appropriate backend service, and handles others by invoking multiple backend services and aggregating the results. If there are failures in the backend services, the API gateway can mask them by returning cached or default data.
The Role of API Gateways in Microservice Architectures
An API gateway is the conductor that organizes the requests being processed by the microservices architecture to create simplified experience for the user. It’s a translator, taking a client’s many requests and turning them into just one, to reduce the number of round trips between the client and application. An API gateway is set up in front of the microservices and becomes the entry point for every new request being executed by the app. It simplifies both the client implementations and the microservices app.