mardi 3 mars 2015

Grouping and nesting of REST APIs


My question is around best practice of aggregating or grouping REST APIs. I have a scenario where there are many different vendors, data sources, etc. and I think grouping REST APIs would make a lot of sense to keep the system maintainable.


I have many scenarios where there will be a single API call triggering many other (similar) API calls. For example for an example entity "client":



  1. Front-end calls REST API: PUT .../client

  2. What I envision is that the code listening on the above API will then make multiple REST PUT calls to let's say vendorA/client, vendorB/client, vendorC/client, internalSystemA/client, internalSystemB/client, etc.


Like this:



+-------------------+
+--------+ PUT +-----------+ CALL | Vendor A API |
| | +-------> | Client +--------> | |
| | | +-----------+ +-------------------+
| | |
| Front | PUT +--------++ PUT +-----------+ INSERT +-------------------+
| End +------> | Client +------> | Client +--------> | Internal System |
| | +--------++ +-----------+ +-------------------+
| | |
| | | +-----------+ CALL +-------------------+
| | +-------> | Client +--------> | Vendor B API |
+--------+ PUT +-----------+ | |
+-------------------+
+ +
+---------------------------------+
Internal REST APIs


What is the best practice to group and nest REST APIs in such a scenario? Is it a good idea to group them by vendor or should they be grouped functional or by business entity? How would the URL look like?





Aucun commentaire:

Enregistrer un commentaire