I have received a couple of inquiries on how GraphQL Queries can be executed from AgilePoint NX Process and eForms. This article will go in-depth into how to configure a GraphQL Query using AgilePoint.
However before I begin, lets first understand what is GraphQL
GraphQL is an open-source query language for your APIs with a service-side runtime for executing the queries based on pre-defined schema. It is not tied to any specific database but rather backed by your existing code and data.
- A GraphQL API is different from a REST API in that it allows the client application to query for certain fields of resources. Send a GraphQL query to your API and get exactly what you need, like the name of a user and only receive that data.
- GraphQL APIs get’s all the data a client needs in a single request.
- It replaces multiple REST requests with a single call to fetch the data you specify.
- Provides an abstraction layer to the client, which means that clients do not need to query multiple URLs to access different data.
When a HTTP GraphQL request is made with a query, the GraphQL server parses the query and respond back with data usually in a specific JSON format. There can also be variables in a query which makes it more powerful and dynamic. In GraphQL, the HTTP verb is predominantly POST but there can be implementations where Query & Variables are sent in URL encoded query parameters in the URL. I have used Microsoft Graph API endpoint and SpaceX endpoint to call GraphQL queries using AgilePoint NX process and forms.
Call A GraphQL Query Using AgilePoint:
REST connector in AgilePoint NX can be used to call a GraphQL query based API. Though it is labelled as REST API connector for ease of understanding as that is majority of use case, in reality it is a more generic HTTP connector and can call any HTTP service. I am leveraging that feature to configure GraphQL Query.
Lets look at this in action in the following video.