HTTP API
Theory: OpenAPI (Swagger Specification)
The REST style leaves a lot of decisions up to the developers.
On the one hand, the task of REST is not to set a specification but to define the principles that allow you to build a good HTTP API. In this sense, REST is a well-thought-out concept, doesn't depend on trends, and has existed for decades without change.
On the other hand, it has the freedom in:
- How links are organized
- What data structures are sent
- How data is returned
It means all REST APIs are quite different and sometimes quite strong.
It leads to a large number of problems, which are easily solvable in the RPC protocols:
- The documentation is described manually and is different in each API
- There's no automatic way to verify if API passes calls and parameters correctly
- The language doesn't generate test code or data structures to work with API data
- There's static analysis, such as highlighting incorrect queries in the editor
The OpenAPI standard solves these and other issues. It is a simple and language-independent way to describe the API in a format that both machines and humans can understand. Programmers use it to automatically generate documentation, tests, and code for executing queries and checking the correctness of data:
Here we can see a set of endpoints that define the structure of the parameters expected to be input and the output data. Using this description and the relevant libraries for each language, we can generate documentation, test code, the necessary classes to store this data, and even a library to perform queries to this API.


