Live Chat Icon For mobile
Live Chat Icon

Connecting Your Reports to OData

Connecting Your Reports to ODATA REST APIs

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.

As a first step, launch the Bold Reports Enterprise server demo site, referring to the steps to create a report, and create a new report.

Blank report in editing view
Blank report in editing view

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.

Data pane view
Data pane view

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 connection type
Choose connection type

Choose the OData data source connector. The OData connection panel will be displayed.

New data source connection pane
New data source connection pane

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.

Connection properties
Connection properties

Click Connect to create a data source.

Design query

After connecting, you will get into the query design view with the invoice table displayed in the left pane of a tree view.

Query Designer
Invoice table fetched from OData

Drag the table into the design pane and select the required columns for the table. Execute the query and click Finish.

Execute Query
Execute invoice query

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.

Data List
Data list

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.

Report Design View
Report design view

Preview report

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.

Report displaying invoice details
Report displaying invoice details

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:

  1. Choose GET in Method drop-down.
  2. Then, specify an OData URL with parameters in the URL field and click Connect.

    Passing parameters in URL
    Passing parameters in URL

Based on the specified parameter value, the data will be fetched from the OData feed.

Data filtered in query designer
Data filtered in query designer

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:

  1. Click  + ADD to add a new parameter.

    Add parameters
    Add parameters
  2. Enter the property name and its value to post the data.

    Enter parameter values
    Enter parameter values

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:

  1. Click  + ADD to add a new header.

    Adding headers
    Adding headers
  2. Enter the valid key and its value required to connect with the OData feed.

    Enter header key and value
    Enter header key and value

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.

Authentication types

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.

OData Authentication
OData Authentication

Conclusion

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!

Stay tuned to our official TwitterFacebookLinkedInPinterest, and Instagram pages for announcements about upcoming releases.

Leave a Reply