Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Basic Jira Software Reports at Go using APIs

Hi All,

In this article, I will showcase how easy it is for us to extract the data from APIs available in Atlassian Cloud / Data Center to quickly prepare the report for small use cases or to understand any other needs apart from the default reports that Jira provides.

With Jira Software Cloud APIs we will be able to query data related to Backlog, Boards, Epic, Sprints, Development Information, Builds, and Deployments

One such requirement we had was to Identify the Project Managers on board which consisted of several parallel sprints.

We had the board ID to list all the sprints in the board with this API along with pagination.

Once we had the sprint details, project manager's details were present in issues and we had to get all the issues in each sprint with this API

It was all about implementing logic once the data was queried for project managers and CSV was prepared with sprint and project manager's details.

The gist of the Script we used

#! /usr/bin/bash

rm sprintdets.csv > /dev/null 2>&1
rm pmsdata.csv > /dev/null 2>&1

export token=
export email=
export domain=

read -p 'Enter boardId: ' boardId

echo "collecting Sprint Details"


while [ $hasData ]; do
sprintDets=$(curl -s --request GET --url "https://${domain}/rest/agile/1.0/board/${boardId}/sprint?startAt=${scount}" -u "${email}:${token}" --header "Accept: application/json" | jq -r '.values | .[] | [.self, .id, .state, .name, .startDate, .endDate, .completeDate] | @csv' | tr -d '"')
curl -s --request GET --url "https://${domain}/rest/agile/1.0/board/${boardId}/sprint?startAt=${scount}" -u "${email}:${token}" --header "Accept: application/json" | jq -r '.values | .[] | [.self, .id, .state, .name, .startDate, .endDate, .completeDate] | @csv' | tr -d '"' >> sprintdets.csv
if [ -z "$sprintDets" ]; then
scount=$(expr $scount + 50)


echo "Collecting Project Manger Details for the Sprints ..."
while read line || [ -n "$line" ]
line=$(echo "$line" | sed -e 's/\r//g' | awk -F "," '{print $2}')
sprintId=$(echo $line | awk -F "," '{print $1}')
PM=$(curl -s --request GET --url "https://${domain}/rest/agile/1.0/board/${boardId}/sprint/${sprintId}/issue" -u "${email}:${token}" --header "Accept: application/json" | jq -r '.issues | .[].fields.customfield_10238 | .[] | [.emailAddress] | @csv' | tr -d '"' | sed -e 's/\r//g') #, .displayName
eval "arr=($PM)"
sorted_unique_ids=($(printf "%s\n" "${arr[@]}" | sort -u))
sed -i "${count}s $ ,$PM " sprintdets.csv
count=$(expr $count + 1)
done < "sprintdets.csv"

I hope this article will help you understand the importance of APIs available in the Atlassian Platform and how we can leverage the same to prepare the report

Do comment if you ran into scenarios where you might have prepared data with APIs


1 comment

Alex Koxaras Community Leader Sep 25, 2022

Thank you for sharing this @Pramodh M !

Like Pramodh M likes this


Log in or Sign up to comment

Atlassian Community Events