... | ... | @@ -5,9 +5,9 @@ Along with the API on the server-side, a python3 client-side helper is hosted at |
|
|
|
|
|
The main advantage of using the API Client is to simplify the use of the API by providing a new layer of API on top of the REST API of the servers that takes care of most of the difficult actions to do on the API (authentication, handling the data, using the right URLs, ...).
|
|
|
|
|
|
Sometimes referred as "layered API" or "onion API", this concepts allow to have a very simple interface but doing basic operations on top of which a program can be built. That simplified interface is using assumed to be stable and reliable as officially maintained. And in the case of a need for more precise operations, one can still "remove one layer" of the API and use the one below to have more control over the operations. But, of course, removing one layer has the downside of risking a bad (re)implementation of the complex steps that were hidden before.
|
|
|
Sometimes referred as "layered API" or "onion API", this concept allows to have a very simple interface offering basic operations on top of which a program can be built. That simplified interface is assumed to be stable and reliable as officially maintained. And in case of need of more precise operations, one can still "remove one layer" of the API and use the one below to have more control over the operations. But, of course, removing one layer has the downside of risking a bad (re)implementation of the complex steps that were hidden before.
|
|
|
|
|
|
In the python3 Re2o's API Client, this model has currently 3 layers represented on the following diagram. The closest to the HTTP protocol a layer is the more complex it is to handle everything but the more precise the usage can be. On every layer, there are example of what this layer deals with. If one layer is removed or bypassed, one need to take of reimplementing what was in it.
|
|
|
In the python3 Re2o's API Client, this model has currently 3 layers represented on the following diagram. The closer to the HTTP protocol a layer is, the more complex it is to handle everything, but the more precise the usage can be. On every layer, there are examples of what this layer deals with. If one layer is removed or bypassed, one needs to implement what was in it.
|
|
|
|
|
|
![api_layers](/uploads/2a41dc540ae9b26b1e29cf5173fe1dbb/api_layers.png)
|
|
|
|
... | ... | @@ -21,7 +21,7 @@ The usage of this API Client is meant to be very easy. The first step is to incl |
|
|
git submodule add https://gitlab.federez.net/re2o/re2oapi.git
|
|
|
```
|
|
|
|
|
|
Then use the package in your code. Every endpoint of the API is hidden in the client and exposed via methods like `.list_<model_name>()`. For example:
|
|
|
Then use the package in your code. Each endpoint of the API is hidden in the client and exposed via methods like `.list_<model_name>()`. For example:
|
|
|
```python
|
|
|
from re2oapi import Re2oAPIClient
|
|
|
|
... | ... | |