Digesting From Backend Systems With System APIs (MuleSoft)
This tutorial explains how to complete digesting from Backend Systems with Systems API, using MuleSoft to get the job done.
Join the DZone community and get the full member experience.Join For Free
System APIs reconcile between backend systems and Process APIs by unbarring data in these backend systems. Some questions that arise include:
- Should there be only one System API per backend system or several?
- How much of the complexity of the backend system should be exposed in the System APIs in front of that backend system? In other words, how much to abstract from the backend the system data model in the API data model of the System APIs in front of that backend system?
- System APIs, same as all APIs, should be defined at a granularity that makes business sense and adheres to the Individual Responsibility Principle.
- It is, therefore, logical that any non-trivial backend system must be fronted by more than one System API.
- If an Enterprise Data Model is in use then
- The API data model of System APIs should make use of data types from that Enterprise Data Model.
- The corresponding API implementation should translate among these data types from the Enterprise Data Model and the primary data model of the backend system.
- If no Enterprise Data Model is introduced then consider the following:
- Each System API should be allocated to a Bounded Context, the API data model of System APIs to be sure to use of data types from the corresponding Bounded Context Data Model.
- A similar API implementation should interpret among those data types from the Bounded Context Data Model and the primary data model of the backend system.
- In this situation, the data types in the Bounded Context Data Model are explained merely in terms of their business characteristics and are typically not associated with the native data model of the backend system. In other words, the translation effort may be significant.
- If no Enterprise Data Model is in practice and the interpretation of a clean Bounded Context Data Model is considered too much effort, consider the following:
- The API data model of System APIs should make usage of data types that closely mirror those from the backend system.
- Same semantics and naming as backend system.
- As for the only data types that fit the functionality of the System API in question, the backend system often is Big Balls of Mud that cover many distinct Bounded Contexts.
- Easily sanitized.
- Using idiomatic JSON data types and naming and correcting misspellings.
- Expose all fields needed for the given System API’s functionality, but not significantly additional.
- Making perfect use of REST conventions.
The following method is as revealing in System APIs as an API data model that echoes that of the backend system. It does not provide expected isolation from backend systems over the System API tier on its own. In special, it will typically not be possible to "swap out" a backend system without significantly improving all System APIs in front of that backend system and, consequently, the API implementations of all Process APIs that depend on those System APIs. This is because it is not acceptable to continue the life of a previous backend system’s data model in the form of the API data model of System APIs that now fronts a new backend system. The API data models of System APIs following this procedure must therefore improve while the backend system is replaced.
On the other hand, the following may apply:
• It is a pretty pragmatic approach that adds relatively little overhead over obtaining the backend system directly.
• Detaches API clients from complications of the backend system outside the data model (protocol, authentication, connection pooling, network address, etc.).
• Allows the usual API policies to be applied to System APIs.
• Makes the API data model for communicating with the backend system explicit and visible, by exposing it in the RAML definitions of the System APIs.
• Further isolation from the backend system data model does occur in the API implementations of the Process API tier.
Opinions expressed by DZone contributors are their own.