Unleash the power of Anypoint DataGraph
With Anypoint DataGraph, you can reuse multiple APIs in a single request. Enterprise architects can easily unify APIs into one data service all without writing more code. Developers can consume multiple APIs from the data service in a single GraphQL request.
Join the DZone community and get the full member experience.Join For Free
In this blog, we will be learn about how to unify multiple APIs into single data service with Anypoint DataGraph. Before we start with Anypoint DataGraph, we need to understand the GraphQL and Anypoint DataGraph is the layer built on the top of GraphQL.
GraphQL is an open-source query language for Rest API's and it is developed by Facebook in 2012 before releasing publicly in 2015. GraphQL allows you to send the query to your API and get the required data.
REST APIs are powerful and follow a resource-oriented and well-structured approach. However, when the data is complex and it is not possible to fetch all the data within a single request as it involved various operations and routes get more complex. GraphQL is very useful in such cases and structures data in the form of a graph with its powerful query syntax for traversing, retrieving, and modifying data.
GraphQL is capable of aggregating the data, returns predictable data to the clients.
Anypoint DataGraph is component of Anypoint Platform which allows you to unify the multiple APIs into single data service.
With Anypoint DataGraph, you can reuse multiple APIs in a single request. Enterprise architects can easily unify APIs into one data service — all without writing more code. Developers can consume multiple APIs from the data service in a single GraphQL request.
Advantages of Anypoint DataGraph
- Unify the multiple APIs into the single data service. With Anypoint DataGraph, you can serve data from multiple underlying APIs within single request without writing any code.
- Consume the data from multiple APIs using single request.
- Developer doesn't have to write the code to parse the data from multiple APIs.
- Anypoint DataGraph is managed service, no maintenance or patching for IT.
Anypoint DataGraph supports:
- REST APIs with RAML and OAS specifications
- Only GET methods
- 250 APIs per unified schema
- 16,000 fields per unified schema
Anypoint DataGraph restricts downstream REST API calls to:
- A maximum of 150 concurrent or ongoing calls per unified schema
- A 5 second timeout per call
- A maximum of 5 MB of response data per call
Anypoint DataGraph limits the query service to:
- A 30 second timeout per query
- A maximum of 100 selected fields per query.
DataGraph support below list of Authentication mechanism while calling underlying APIs
- Basic Authentication
- Client Id Enforcement via Headers
- Client Id Enforcement via Query Params
- Custom (Add Custom headers or Query Params)
Use Case 1
Let's consider the scenario, you have Rest API that returns 10 fields in response but web application requires only 7 fields whereas mobile application requires only 4 fields. In such cases, DataGraph is one of the most optimal options where the client can pass whatever data required as an input request, and DataGraph will return the required fields to the Web Application and Mobile Application. Below is the illustration of Use Case 1.
Use Case 2
Let's consider the scenario where you have to call multiple Rest APIs or want to fetch data from multiple rest API's and each APIs will respond with JSON payload. GraphQL will aggregate all the responses and send back the required data to the client. Below is the illustration of Use Case 2.
Unleash the power of Anypoint DataGraph - Part I
Unleash the power of Anypoint DataGraph - Part II
Unleash the power of Anypoint DataGraph - Part III
Now, you know how to use Anypoint DataGraph and what are different use cases where Anypoint DataGraph can be used.
Opinions expressed by DZone contributors are their own.