API Query can Simplify Architecture and Improve Efficiency
The era of smart devices and apps has transformed the way application integrations work. These integrations need to be performed with limited memory and in constrained bandwidth environments. For a long time, REST was the choice for such integrations because of its simplicity. ?There is no doubt that REST has simplified integrations. But consumers of the APIs have no way to control the size and shape of the API response. Moreover, REST is based on the principle of resources; if a consumer needs data from two different resources, two separate requests go to the server.
Figure 1: REST API client requesting data from multiple sources
This is the problem API-querying technologies like GraphQL and OData are trying to address. API-querying technologies enable API users to query only the information required from multiple data sources with a single request. These technologies?expand the idea of SQL to web APIs by exposing the complete business object to users – providing them the ability to query an object by declaring the fields and conditions in the API request. Only the information that a user requested is returned in the single API response. This means no over-fetch, no under-fetch – only the precise information requested is retrieved.
Figure 2: Client requesting data from multiple sources using GraphQL/OData?
These technologies help applications that run on devices and the front-end to offer the best user experience in low CPU and low bandwidths, rather than spending computing resources for processing heavy response data. However, API querying is not just restricted to a front-end layer; it can be applied to any layer of the enterprise.
领英推荐
Wipro helped one of the largest financial institutions in the US to modernize its legacy application stack using GraphQL. The financial leader was running an application on the mainframe and wanted to gradually migrate to reduce the recurring cost of MIPS on the mainframe. The customer selected Cassandra as the target data platform and exposed data APIs on this platform.
Wipro leveraged these data APIs to build GraphQL-enabled Springboot microservices for customer profile, express consent, and more. The benefits to the financial leader not only included lean and clean API use, but also a simplified architecture by aggregating multiple data APIs and presenting the data as a single business object for use by internal and external applications.
?When to Use API Querying or REST
?API querying is a good option when –
That doesn’t mean REST is going away. Certain high-performance queries need to be addressed by REST to avoid an additional layer of API query. In addition, REST also provides a robust framework based on HTTP, which is easily comprehensible to both machines and humans. However, API query is an intuitive way to fetch exactly the information requested.
This article is also published on wiprodigital
Principal Enterprise Architect -Integration -BT
3 年Insightful..it really helps