In this blog post, we will walk you through the steps to connect your OData feed to Bold Reports. Let’s start!
Bold Reports provides an OData data source connector to connect with OData feeds using GET/POST methods. The connector also allows you to add request headers and parameters. The connector lets you retrieve responses in JSON or XML formats and allows basic HTTP authentication or open connections through No Authentication mode. So, you can connect to any OData RESTful APIs and supply data to your report.
Choose OData connector
To create a new data source with the OData connection, select the data source icon on the right. Doing so will expand the data source panel.
In the DATA configuration panel, click on the NEW DATA button. The DATA SOURCES panel lists the data connectors as shown in the following screenshot.
Choose the OData data source connector. The OData connection panel will be displayed.
OData connector process
In the connection properties, provide a unique name for the data source. Enter your OData URL and add an authentication key and value under the Header(s) section (if you have any). Set the data format of the result returned by the query from the OData. For example, let’s execute a simple GET request that will return invoice details from the OData. To do this, refer to the OData API documentation and provide the valid URL to get the invoice details.
Click Connect to create a data source.
After connecting, you will get into the query design view with the invoice table displayed in the left pane of a tree view.
Drag the table into the design pane and select the required columns for the table. Execute the query and click Finish.
Note: In schema tree, the nested fields in the specified OData feed will be shown as a flat structure.
The designer page will load so you can proceed with designing your report with this data source.
Design a report
Using this data, we can design an invoice details report. Refer to the Report Designer documentation and create a similar report design.
You can preview the report at design time using the built-in Bold Report Viewer to ensure the report design is as expected. Switch to the preview mode. In preview, the report will display the invoice details like in the following screenshot.
How to pass parameters and headers
In the previous sections, we have seen how to fetch data from an OData feed using a simple GET action and make a simple invoice report design using it. Now, let’s see how to pass parameters, headers, and authentication credentials in an OData data source connector.
How to pass parameters for GET action
For GET actions, we can pass the parameters along with a valid OData URL in the URL field:
- Choose GET in Method drop-down.
- Then, specify an OData URL with parameters in the URL field and click Connect.
Based on the specified parameter value, the data will be fetched from the OData feed.
To pass dynamic values for parameters, refer to the Pass dynamic value for URL section.
How to pass parameters for POST action
Enter the OData URL in the URL field. Then choose POST in the Method drop-down. The parameter option will start displaying once you do. To add a parameter, follow these steps:
- Click + ADD to add a new parameter.
- Enter the property name and its value to post the data.
During report processing, you can pass dynamic values for each parameter using expressions. Refer to the How to pass dynamic values for parameters section. You can also pass the parameters as raw data. Refer to the How to pass raw data section to learn more.
How to pass headers
Based on the OData feed, pass the required headers in the Header(s) property. To add headers, follow these steps:
- Click + ADD to add a new header.
- Enter the valid key and its value required to connect with the OData feed.
Similarly, you can add multiple headers and pass a value for them. During report processing, you can pass dynamic values for each key in headers using expressions. Refer to the How to pass dynamic values for headers section.
You can set the authentication type, as either None or Basic HTTP Authentication.
Use None type in the following cases:
- If your data source supports authentication directly through the OData URL, choose None under Authentication Type.
- If your data source supports API key or API token authentication, pass these values under Header(s) by clicking +Add. Choose None under Authentication Type.
Use Basic Http Authentication if your data source requires a username and password to authenticate. Choose Basic HTTP Authentication under Authentication Type and input the username and password.
We hope this blog post helps you connect to OData feeds using Bold Reports. To further expand your report, you can explore the Bold Report Designer documentation. I have also attached the generated .rdl file for further reference.
If you have any questions, please post them in the comments section. You can also contact us through our contact page or, if you already have an account, you can log in to submit your support question.
Bold Reports now comes with a 15-day free trial with no credit card information required. We welcome you to start a free trial and experience Bold Reports for yourself. Give it a try and let us know what you think!