Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the assignee and story point of subtask with along with parent story using GetIssue API

amir.s
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 1, 2022

Hi,

I hope all of you are feeling well!

Problem statement: Currently we want to fetch the detail of each story/task along with there all the sub-tasks details.

Implementation: we are using Jira-connector and client to get the issue details and their sub-task details which working fine but the story point and assignees of sub-tasks are missing in JSON.

Requirement: Is there any way to get the assignee and story points/estimation of sub-task details along with parent issue/story/task in one query or API

THANKS in advance for your help.

please check some screenshots of my response JSON

1) The first screenshot is related to the parent story/issue having assignee info.

story assignee.JPG
2) The second one is subtask details and we haven't found any assignee in json.

subtask.JPG

2 answers

0 votes
Melese Wondim
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 2, 2022

In the foreach you need to do the issues api call store the response in a variable and pass it to 'subtask-key' => $subtasks

 public function Report()
            {
                $response = Http::withHeaders(['Authorization' =>  env('JIRA_AUTH')])->get('URL/rest/agile/1.0/board/{{board_id}}/issue');
                $issues = [];
                foreach ($response['issues'] as $issue) {
 
                    $issueSubtasks = [];
                        foreach ($issue['fields']['subtasks']as $subTasks)
                        {
                            $APIResponse = Http::withHeaders(['Authorization' =>  env('JIRA_AUTH')])->get('URL/rest/api/2/issue/'.$subTasks['key']);
                            array_push($issueSubtasks, [                          
                                "key" => $APIResponse["key"],
                                "assignee_name" => $APIResponse["fields"]["assignee"],
                            ]);
                        }
                        array_push($issues, [
                            "id" => $issue["id"],
                            "subtask" => $issueSubtasks,  
                        ]);
                }
                          return $issues;
            }
0 votes
Mohamed Benziane
Community Champion
March 1, 2022

Hi @amir.s 

Welcome to the community

The doc show that you can only have few fields of the subtask from the parent in the REST API, you'll need to make another call for the subtask to get all the info you want.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events