Getting Started with Custom Reports

Overview

In this guide, we’ll walk you through creating your first Custom Report by connecting to an open REST API. Follow these simple steps to set up your datasource, fetch data, and display it on your dashboard!

 

Open REST API: https://randomuser.me/api/?results=3

{ "results": [ { "gender": "male", "name": { "title": "Mr", "first": "Jorge", "last": "Silveira" }, "location": { "street": { "number": 7521, "name": "Rua Mato Grosso " }, "city": "Sertãozinho", "state": "Pernambuco", "country": "Brazil", "postcode": 50956, "coordinates": { "latitude": "-78.6841", "longitude": "-111.5651" }, "timezone": { "offset": "-10:00", "description": "Hawaii" } }, "email": "jorge.silveira@example.com", "login": { "uuid": "8e1c6c97-2bef-49ab-a78e-c33da2c768c6", "username": "orangetiger800", "password": "hockey1", "salt": "iR39MNR4", "md5": "63159ddf43eaf10dfdb3a18890b79c81", "sha1": "0976fa72a02acb372c016d93e0eac41cece323f4", "sha256": "4bf3fd9358288c55092cfe84b8006e29edd5997b39ae2a1c519e09d8109b710c" }, "dob": { "date": "1955-11-25T16:33:33.509Z", "age": 69 }, "registered": { "date": "2006-01-03T05:01:02.181Z", "age": 18 }, "phone": "(61) 7435-7446", "cell": "(76) 9063-4030", "id": { "name": "CPF", "value": "017.416.111-43" }, "picture": { "large": "https://randomuser.me/api/portraits/men/84.jpg", "medium": "https://randomuser.me/api/portraits/med/men/84.jpg", "thumbnail": "https://randomuser.me/api/portraits/thumb/men/84.jpg" }, "nat": "BR" }, { "gender": "female", "name": { "title": "Ms", "first": "Cherly", "last": "Duncan" }, "location": { "street": { "number": 697, "name": "Ranchview Dr" }, "city": "Hervey Bay", "state": "Australian Capital Territory", "country": "Australia", "postcode": 2902, "coordinates": { "latitude": "-9.3319", "longitude": "55.4757" }, "timezone": { "offset": "-11:00", "description": "Midway Island, Samoa" } }, "email": "cherly.duncan@example.com", "login": { "uuid": "b9f0b661-5111-4c62-9312-750b23f01b70", "username": "beautifulostrich428", "password": "frogman", "salt": "jRcWz5Ya", "md5": "0990a44618b955a0199f7c1fc326a7be", "sha1": "829f81f80c77e40da83598ef71d1f323659bbd34", "sha256": "ad94362a9975468361a2432108c9431613aa8396341f3914727c809d46cdc1d4" }, "dob": { "date": "1961-12-15T19:39:29.052Z", "age": 62 }, "registered": { "date": "2016-09-19T21:53:28.884Z", "age": 8 }, "phone": "09-3882-7235", "cell": "0408-363-067", "id": { "name": "TFN", "value": "762794031" }, "picture": { "large": "https://randomuser.me/api/portraits/women/8.jpg", "medium": "https://randomuser.me/api/portraits/med/women/8.jpg", "thumbnail": "https://randomuser.me/api/portraits/thumb/women/8.jpg" }, "nat": "AU" }, { "gender": "male", "name": { "title": "Mr", "first": "Ceyhun", "last": "Pekkan" }, "location": { "street": { "number": 5966, "name": "Necatibey Cd" }, "city": "Siirt", "state": "Ağrı", "country": "Turkey", "postcode": 70616, "coordinates": { "latitude": "-15.3614", "longitude": "-124.7833" }, "timezone": { "offset": "-1:00", "description": "Azores, Cape Verde Islands" } }, "email": "ceyhun.pekkan@example.com", "login": { "uuid": "b0c6ec05-1a54-4b1f-adc4-b3580d5b51ab", "username": "redgorilla214", "password": "adams", "salt": "vOfO1wXP", "md5": "7fb5b32ba8ec53b3502aca1b6c3c78f8", "sha1": "71fc56c61d633e1be82e2d35c9201b1ef23be025", "sha256": "8bf87045fc3aa9a651ff0790863963b141586f39a40650e914a2cc9073d93d79" }, "dob": { "date": "1983-06-30T11:50:27.717Z", "age": 41 }, "registered": { "date": "2017-12-15T16:54:49.189Z", "age": 6 }, "phone": "(648)-443-0757", "cell": "(258)-232-5598", "id": { "name": "", "value": null }, "picture": { "large": "https://randomuser.me/api/portraits/men/12.jpg", "medium": "https://randomuser.me/api/portraits/med/men/12.jpg", "thumbnail": "https://randomuser.me/api/portraits/thumb/men/12.jpg" }, "nat": "TR" } ], "info": { "seed": "0a2165d5cb728937", "results": 3, "page": 1, "version": "1.4" } }

 

random_users-table.png

Add a Datasource

  1. In the Custom Reports dashboard view, click .

  2. Click Add datasource (New to datasources? check Learn about Datasources).

  3. Provide a meaningful name for your datasource, such as Random User - No Auth for this example.

  4. Enter the API endpoint URL in the provided field https://randomuser.me

  5. Set Authentication type: No Auth for this example. To understand each authentication type more thoroughly, see Authentication types in Custom Reports datasources.

  6. Click Add.

add_datasource_random_user.png

 

 

Add the Custom Reports gadget

  1. Navigate to your Dashboard Hub app.

  2. If you have not created a dashboard,

    1. Click the dashboard dropdown in the left corner or in the action menu in the right corner, and select Create dashboard.

    2. Name your dashboard, and click Create.

    3. Click Add Gadget.

  3. If you already have a dashboard created, click Edit.

  4. Click Add Gadget.

  5. Type Custom Reports in the search bar in the gadget catalog, or navigate to the Custom Reports section in the left side navigation panel.

  6. Locate the Custom Reports gadget, click Add, and click Open Editor.

 

 

 

Example: Random people in a table

Copy the JSON content in the following code block on the right. This simple report displays three random people in a table with three columns.

How it works

  1. Data Fetching

uri: 'datasource://random_DS/api/?results=3',

The REST API at https://randomuser.me/api/?results=3 returns a JSON object containing random user details.

The uri section starts with datasource://random_DS, which is the name we use to refer to our datasource field, and following, the rest of the URI /api/ .

Then we use a query param ?results=3 to return from that API just 3 random users.

  1. Data Parsing and Display

The gadget processes the returned JSON and extracts the results array.

path: 'results',

A node type: 'table' is generated with three columns:

  • The column Name displays the user’s picture and full name (title, first, and last).

    • header: 'Name'

    • src: '{picture.thumbnail}'

    • '{name.title} {name.first} {name.last}'

  • The column Age displays the user’s age.

    • header: 'Age',

    • cell: '{dob.age}'

  • The column Country displays the user’s country.

    • header: 'Country',
      cell: '{location.country}'

The dot notation is used to traverse paths in the JSON response. Remember that JSON looked like the following:

 

Download this JSON response here:

 

 

 

  1. Style

You need to be familiarised with CSS to better style your reports, for example:

This is part of Flexbox styling (ref), commonly used in web development to define how elements are laid out and behave within a flexible container.


This sets the width of the image to 40 pixels, automatically adjusts the image’s height to maintain its original aspect ratio, and rounds the image into a circle by applying a radius of 50% of the image’s dimensions.

 

Save and Publish Your Report

  1. Use the live Preview panel to review the final output.

  2. Click Save and your report is ready to be shared with your colleagues.

Troubleshooting Common Issues

  1. Error: Cannot Connect to Datasource:

    • Double-check the API URL and ensure it uses HTTPS.

    • Verify your authentication credentials and token expiration.

  2. Visualization Problems:

    • Ensure all required fields are correctly mapped in the visualization editor.

  3. Use the Debug Mode (toggle in the editor toolbar) to inspect data and ensure the JSON structure matches the visualization requirements.

Advanced Knowledge

To move to the next level of Custom Reports, you should learn:

  • JSONata: JSON query and transformation language.

  • CSS: To style your reports.

  • Recharts: The composable charting library built on React components behind our charts.

What’s next?

Confluence®, Jira®, Atlassian Bamboo®, Bitbucket®, Fisheye®, and Atlassian Crucible® are registered trademarks of Atlassian®
Copyright © 2005 - 2024 Appfire | All rights reserved. Appfire™, the 'Apps for makers™' slogan and Bob Swift Atlassian Apps™ are all trademarks of Appfire Technologies, LLC.