Web API data source

Web report designer supports to connect the RESTful web services.

Connect Web API data source

A Web API data source can be created through the following procedure:

1.In the configuration panel, click the Data icon to launch a Data configuration panel.

Configuration Panel

2.Click the Add DataSet button in Data panel.

Dataset creation wizard

3.Click Create New in the context menu, it will launch connection type panel. In the connection type panel, click on the WebAPI data source type.

Connect web api datasource

4.In the new data source configuration panel,

Datasource creation wizard

  • Name box: Specify the data source name without special characters.

  • URL: Specify the service url without action name.

  • Schema: Specify the valid URL path of XML data.

  • xml
  • <Schema Name="Schemas">
        <Method Name="SalesData" Method="GetData" ActionType="Get"> </Method>
        <Method Name="StoreSales" Method="GetParamData" ActionType="Get">
            <Parameter>
                <Name>queryParam</Name>
                <Type>System.String</Type>
            </Parameter>
        </Method>
    </Schema>

    The schema data must have the well defined XML format. Schema field is optional, by default the query editor mode will be enabled if schema url is not provided by the user.

    • Authentication Type: By default, the authentication type will be provided as None. To change the authentication type, choose your desired type from the authentication field dropdown.

      • Windows - User’s windows credentials will be used to access the web API service.

      • Basic HTTP - Enter the valid username and password to access the web API service.

      • Custom - Provide the valid header name and value to access the web API service.

    5.Click the Connect button. Now the schema information will be listed in the query designer tree view.

    Query designer view

    You can enter the query directly in the Query Editor or use the Query Designer to interactively build the query and view the result of the query.

    Design Mode

    The left pane holds the tables and views associated with the connected web API service.

    1. Drag your preferred table or view from the left pane and drop into the center pane labeled with Drag and Drop table here like below:

      Drag table

    2. Now execute the query, the data will be retrieved based on the specified query.

      Execute preview

    Code Mode

    1.To switch over to Query Editor, click the switcher icon in the designer toolbar.

    Enter the query directly with Query Editor

    2.Enter the ActionType, Method, Headers and Parameters in the query editor like below example,

  • c#
  • ActionType=Get;Method=GetParamData;Headers=[{"Key":"Auth_token","Value":"bearer eXteLlxMA1hPs7utvHJE3JSxVAm3HHpjUNZBNsL2VEX4c3tQtHFf8P7NXT921mnErHqxE8ILdhTkx3Mpd"}];Parameters=[{"Key":"queryParam","Value":"CA"}]

    3.Now, execute the query.

    Query Editor view

    Using API query builder

    The API query can be built using the API query builder option provided in the query designer toolbar.

    Click the {API} icon (highlighted below) to open API query builder.

    Api builder option

    It will launch the API query builder dialog like below,

    Api builder dialog

    POST action : Choose the action type as POST in the Action field.

    Api builder POST action

    • Method : Provide the valid method name that needs to be accessed from web API.

    • RawData: Enter the data in the JSON string format.

      Api builder JSON data

      Api builder raw data

    • Headers: Click on the Add icon to add headers. Provide the valid Header Name and Value.

      Api builder POST action

    GET action : Choose the action type as GET in the Action field.

    Api builder GET action

    • Method : Provide the valid method name that needs to be accessed from web API.

    • Parameters : Click on the Add icon to add parameters. Provide the valid Parameter Name and Value .

    • Headers : Click on the Add icon to add headers. Provide the valid Header Name and Value .

      Resultant data

    Click OK, now the data will be retrieved based on the specified API query.