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
4,362,537
Community Members
 
Community Events
168
Community Groups

Is it possible to view a list of assignees for a given jira ticket using Jira API?

With or without JQL. is it possible to get some result that lists all the assignees for a given srpint. 

Something like this 

{

  "projectName": "something",

  "dateCreated": "2019-01-24T15:43:44.000-0600",

  "summary": "Verify business is OK with update",

  "description": "This has been rolled out into production",

  "assignee": ["john doe", "Maz Doe"], // I need this to be an array
  "status": "Done",

  "statusColor": "label-success",

  "estimated": 0,

  "remaining": 0,

  "logged": 0,

  "estimateTimeDifference": 0,

  "hasEstimateChanged": false,

  "labels": "",

  "components": "something something",

  "epic": null

}

2 answers

1 accepted

1 vote
Answer accepted

Using the changelog parameter to the issues JQL endpoint and with this logic, I got all the assignees for a given issue. 

 

  public listIssueAssignees(issue: Issue): string {

    const histories = issue.changelog ? issue.changelog.histories : [];

    const assignees: string[] = [];

    if (histories) {

      histories.forEach((history: any) => {

        history.items.forEach(

          (item: { field: string; fromString: string; toString: string }) => {

            if (item.field === 'assignee') {

              assignees.push(item.fromString);

              assignees.push(item.toString);

            }

          },

          this

        );

      }, this);

    }

    return [...new Set(assignees)].filter(v => v != null).join(', ');

  }
1 vote

Hello @Maz_Mahari 

Welcome to the community.

A Jira issue can have only one Assignee at a time. Are you trying to extract the history to find out if the Assignee has been changed such that different people were assigned to the issue at different times?

Yes, that's right. I'd love to be able to view a history of past assignees for a given issues

Have you looked at the Jira REST API? The endpoint for getting an issue can return the issue history if you use the expand parameter. You would have to parse through the output to get the entries concerning Assignee, and build your own output array.

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get

Do you mean pair expand with changelog. Because that wouldn't work?

Yes, that is what I meant. I did not actually test it. I suggested it based on the documentation.

It what way does it not work?

Suggest an answer

Log in or Sign up to answer