I have a requirement from my team to show the status of tickets for a certain ticket type on an internal webpage.
I need to display the tickets in the form of a table
Status, Key, Created Summary, Reporter, Assignee, Customfield1, Customfield2
I need to show these tickets for a date range eg all tickets for April or all tickets for May.
In the past, we were manually exporting these tickets with Excel and saving them to a PDF on to a network drive but "Ain't Nobody Got Time for That"
I am not sure how I could go about creating something like this so I wanted to post here to get some ideas on how this could be achieved. Happy to look at code, plugins, powerbi or anything else that could automate this.
Community moderators have prevented the ability to post new answers.
I ended up doing something like this
// Jira Service Management Cloud REST API URL
$url = "https://yoursite.atlassian.net/rest/api/2/search";
// API key for authentication
$api_key = "1234";
// Request parameters
$params = array(
"jql" => "queue = 10018",
"maxResults" => 1000,
"fields" => array(
"status",
"key",
"created",
"summary",
"reporter",
"assignee",
)
);
// Add month filter if specified
if (isset($_GET['month'])) {
$params['jql'] .= " AND created >= '".$_GET['month']."-01' AND created <= '".$_GET['month']."-31'";
}
// HTTP headers
$headers = array(
"Authorization: Basic ".base64_encode($api_key.":".$api_key),
"Content-Type: application/json"
);
// HTTP request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url."?".http_build_query($params));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// Parse JSON response
$data = json_decode($response, true);
// Extract ticket data
$tickets = array();
foreach ($data['issues'] as $issue) {
$ticket = array(
"status" => $issue['fields']['status']['name'],
"key" => $issue['key'],
"created" => $issue['fields']['created'],
"summary" => $issue['fields']['summary'],
"reporter" => $issue['fields']['reporter']['displayName'],
"assignee" => $issue['fields']['assignee']['displayName']
);
$tickets[] = $ticket;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.