Configure a REST API datasource for Custom Reports
Adding a datasource through an API is a little different to the process you use for adding a datasource for our pre-configured connections. In this guide, we’ll walk you through creating your first Custom Report by connecting to an open REST API. You will need to follow this process for each API datasource that you want to add.
How to add a Custom Report datasource
In Dashboard Hub, select More actions (…) > Add Datasource. The datasource selection window displays.
Select Custom Report. The Custom Report configuration form displays.
Provide a descriptive name for the datasource.
Enter the URL of the REST API you want to connect to for the product providing the content for your report.
Select an authorization type and add the corresponding required detials. Basic Auth is recommended for this example. See Authentication types in Custom Reports datasources to learn more.
Click Add to create the datasource.
How to add a Custom Report gadget
Click Edit in the Dashboard Hub dashboard.
Click Add Gadget.
Select the Custom Report gadget.
In the configuration window, select Templates if you already have a saved report. In this example, we create one with the JSON file provided below to list issues from a Jira datasource.
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.
Click Open Editor. The JSON for the fields in the datasource displays and can be configured. See How to configure the datasource, below.
Download the JSON descriptor here:
Jira issues example. 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"
}
]
}
]
}
How to configure the datasource
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.
Optionally, you can define variables to pass to your request. In the Jira example, the variable {$initial.jql} 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.
The response from the API will be mapped to a table.
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.
Save the report configuration.
Need support? Create a request with our support team.
