Creating widgets from a Generic API data source

You can use the Generic API to create widgets that fetch data from IBM® QRadar® APIs and QRadar apps with exposed APIs.

About this task

APIs return either a JSON array (when there are multiple results) or a JSON object (when there is only one result). Returned JSON objects are converted into a JSON array that contains one element.

Procedure

  1. Click Configure dashboard.

    The Configure dashboard screen displays a library of available widgets, with details about each widget.

  2. Click Create new widget.
  3. On the New Dashboard Item page, enter a name and a description for the widget.
  4. Select Generic API from the data source list in the Query section, and enter an API endpoint, such as one of the following examples:
    • /api/asset_model/assets
    • /api/health_data/top_rules
    • /api/config/deployment/hosts
    • /api/config/event_sources/log_source_management/log_sources
    • /console/plugins/<QDI_appId>/app_proxy/comp_status_feed?timediff=471 (enter data in Results mapping).
      Note: The URL might change between versions of QDI.

    For more information, see Tips for creating Generic API queries for dashboard charts.

  5. Optional: Add parameters to the Generic API query.
    1. Insert existing parameters in the statement. Click the Insert Parameter icon, and then click Insert for each relevant parameter.
    2. To change the default value of the parameter, click the View Parameters icon, and click Save after you set the default value.
      When you change the default value for a parameter, you're changing the value everywhere the parameter is used in your workspace, except in expanded or pinned dashboards and widgets. If you don't set the value as the default value, the updated change applies only to the current session. However, if you set the value as the default, the current session value also uses that value.

      The predefined SYSTEM:username parameter returns the username of the user who is logged in. System parameters are read only and you cannot change the default value.

    3. To add a parameter to your workspace, click Add, give the parameter a name and default value, if needed, and then click Save.

      After you add parameters to a widget on a dashboard for the first time, the Parameters card appears on the dashboard. If you remove parameters from the widget, and no other widget in that dashboard uses the parameter, the Parameters card disappears.

  6. Pick a refresh time for how often you poll the data source. The default refresh time is every 5 minutes. The shorter the refresh time, the greater the performance impact on IBM QRadar. The refresh time starts after the query is completed.
    For example, if the query takes 3 minutes to complete, the refresh time starts only after the 3-minute run ends.
  7. If the root object in the returned JSON is not the array you want to plot, enter a Results mapping to define which key contains the relevant data you want to plot. For more information, see Tips for creating Generic API queries for dashboard charts.
  8. Optional: If the returned JSON includes a title mapping, set Use title from the result set to On. For more information, see Tips for creating Generic API queries for dashboard charts.
  9. Click Run Query.
    When you first create the widget, you can't configure the charts if no data results are returned. Try making the criteria in the fields less strict and run the query again.
  10. Create a dashboard chart in the Views section.
    Because you can create multiple views and charts from the same query, give the view a unique name. By default, the chart's title and status on the title bar are displayed; to hide them, click the More options icon and switch the settings to Off.
  11. Select a chart type and configure the relevant properties. For use cases to help you decide which chart type to use, see Widget chart types.
    Chart type Instructions
    Bar Creating a bar chart
    Big Number Creating a big number chart
    Geographic Creating a geographic chart
    Pie Creating a pie chart
    Scatter Creating a scatter chart
    Tabular Creating a tabular chart
    Time Series Creating a time series chart
  12. Preview how the chart looks and then click Save.
    Tip: The labels for the chart come from the queries that are used. If they are unintelligible in the preview, edit the labels in the View section.