How to Connect to a GraphQL Data Source in Bold Reports
GraphQL is an open-source query language that enables clients to request specific data from an API. GraphQL provides a clear and comprehensive description of the data in an API, allowing clients to request exactly what they need and nothing more. It also makes it easier to evolve APIs over time and enables powerful developer tools. GraphQL is often used as an alternative to REST APIs for fetching and manipulating data.
Currently, we don’t have direct support for GraphQL, but we can connect to it through the Web API data connector. To connect to a GraphQL API using Bold Reports through the Web API data connector, follow these steps:
-
Click on the
Data
icon in the configuration panel of Bold Reports. -
In the
DATA
configuration panel, click on theNEW DATA
button. -
In the connection type panel, choose
Web API
in the DATA SOURCES pane as shown in the following snap.
-
Enter a valid GraphQL root URL in the URL text box. This is the endpoint URL of your GraphQL API.
-
Choose the POST Method Type from the combo box for the provided REST API. This indicates that you will be making a POST request to the GraphQL API.
-
Select the “Raw” option for the POST request. This allows you to enter the GraphQL query directly.
-
Enter your GraphQL query in the input text box below the Raw option. This is where you define the specific data you want to retrieve from the GraphQL API. You can refer to the following image.
-
Enter the remaining options, such as headers and authentication type, if required.
-
Choose a JSON data format from the combo box based on the expected response format of your GraphQL API.
-
Click on the “Connect” button to establish the connection between Bold Reports and your GraphQL API.
-
Once connected, you can drag and drop the table from the table schema onto the query design view page.
-
Preview the data in the query designer page to see the results of your GraphQL query.