Skip to end of banner
Go to start of banner

Configure a REST API datasource for Custom Reports

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Overview

This article explains how to add and configure a new datasource for Custom Reports.

On this page:

Add a Datasource

  1. From Dashboard Hub, click (blue star) and select Add Datasource. The datasource selection window displays.

  2. Select Custom Report. The Custom Report configuration form displays.

    1. Provide a descriptive name for the datasource.

    2. Enter the URL of the REST API you wish to connect to for fetching data (i.e., the URL of the product providing the content for your report)

    3. Select an authorization type (see Authentication types in Custom Reports datasources) and enter any required values for that selection.

  3. Click Add to create the datasource.

image-20241212-010526.png

Add a Custom Report

  1. From your dashboard, add a Custom Report.

  2. In the configuration window, select Load Template if you already have a saved report. Or create one with the provided content to list issues from a Jira datasource.

  3. Select the datasource added previously. In the provided example, you need to add a Jira datasource and a JQL query Jira in the provided example.

  4. Click Open Editor. The JSON for the fields in the datasource displays and can be configured.

 Jira issues. Descriptor to list Jira issues in a table:
{
  "type": "rest",
  "uri": "datasource://jira/rest/api/3/search?jql={$initial.jql}&maxResults=5",
  "children": [
    {
      "type": "table",
      "path": "issues",
      "columns": [
        {
          "header": "Issue",
          "accessor": "key"
        },
        {
          "header": "Summary",
          "accessor": "fields.summary"
        },
        {
          "header": "Status",
          "accessor": "fields.status.name"
        }
      ]
    }
  ]
}

Configure the datasource

  1. The uri section starts with datasource://[YOUR_DATASOURCE_VARIABLE_NAME], in our example, jira and following, the rest of the URI rest/api/3/search . Select your previously created datasource from the dropdown. In our example Jira Cloud datasource.

  2. Optionally, you can define variables to pass to your request. In the Jira example, the variable {$initial.jql} which is used in the query as a parameter jql={$initial.jql}. Then, in the input field for our variable jql we are using issuetype = Bug as an example.

  3. The response from the API will be mapped to a table.

  4. Define the columns in the table by mapping attributes and fields returned by the API:

    • key: maps to the issue key.

    • fields.summary: maps to the issue summary field.

    • fields.status.name: maps to the issue status name.

  5. Save the report configuration.

Jira_list_issues_editor.jpg

  • No labels