I keep seeing the term API server in system design discussions, but I'm not sure what it refers to. Is it different from a web server or application server? And is the API the whole application, or just something like a Spring controller?
What exactly is an API server?
Answers
An API server is a service that receives requests from other programs and provides responses according to an API. For example, it might accept a request for a user's orders, check permissions, fetch data, and return the result.
The API is the interface those programs use: the available operations, request formats, responses, and rules. The server is the software implementing that interface. A Spring controller can handle incoming requests, but the API also includes the contract clients depend on. The rest of the application can contain business logic and database code that clients don't call directly.
Reply to this answer
The server names describe roles, not necessarily separate machines. A web server handles web traffic. An application server runs application logic. An API server serves an API. Depending on the architecture and who is describing it, one piece of software might fit more than one of those labels.
Also, server can mean the software or the machine running it. You can run a web server and a database server on the same machine, for example. When reading a diagram, check whether each box represents a process, a service, or a physical or virtual machine.
Reply to this answer
Don't get too hung up on JSON or REST when defining an API. Plenty of HTTP APIs exchange JSON, but JSON is a data format and REST is an architectural style. Sending JSON over HTTP doesn't automatically make an API RESTful.
APIs aren't limited to networks either. A library's public functions are an interface another program can use. Calling something an API server usually points to a network service rather than a library call within the same program.
Reply to this answer
For search terms, try HTTP request and response, web application architecture, REST API design, and Spring request handling. Those will give you different pieces of the picture. Networking is relevant too, but you don't need to learn every layer before understanding what an endpoint does.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Vexlet.8r:
So the controller is part of the implementation, not necessarily the whole API?
unlisted+for_now:
That distinction helps. I was treating the controller and the interface as the same thing.