JIRA REST API to get list of branches related to a issue

visagan santhanam May 18, 2018

Hi,

How do i get the list of branches related to a issue using JIRA REST API.  i tried using the rest/api/2/issue/. but it doesn't return any information related to the branches.

Any Help would be appreciated.

3 answers

3 votes
Maarten Cautreels
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2018

Hi Visigan,

I've been having a look and wasn't able to find an official REST api but when I looked at how Jira itself was getting the data (pull requests but also branches) I've found the following call:

GET /rest/dev-status/1.0/issue/detail?issueId=<ISSUEID>&applicationType=bitbucket&dataType=pullrequest

Unfortunately the request requires the issue ID and not the issue Key. So you'll need to retrieve the issue ID using the Jira Issue REST api first (/rest/api/latest/issue/<ISSUEKEY>) first.

Please do keep in mind this is not an official API which could be changed between Jira versions without any notification.

Best,

Maarten

visagan santhanam June 5, 2018

Thanks, Maarteen

it works for me, but there is an issue. The JSON returns all the commits but only the part of the files committed. if i commit more than 5 files on a single commit, then only the first 5 files are listed in the JSON. any ways to get the full list of files?

Maarten Cautreels
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2018

I’m afraid that using the api of either Bitbucket or github in this case will be the only option.

Best,

Maarten

Sanu Satya June 6, 2018

I tried them too, /rest/api/1.0/projects/{Project}/repos/{Repo}/commits/{commit id} is not returning any information about the files. do you aware of any other bitbucket API which gives me the list of files related to a commit.

Yasashree March 15, 2021

I am receiving response as 200 but no details are pulled

{    "errors": [],    "detail": []}

Abhir Joshi March 20, 2021

@Yasashree, use "stash" instead of "bitbucket.  The following worked for me:

GET /rest/dev-status/1.0/issue/detail?issueId=<ISSUEID>&applicationType=stash&dataType=pullrequest
Like ManasaGD likes this
ashwin March 21, 2021

what is the applicationType for Azure ?

Khaled Badenjki February 10, 2022

it should be `details` instead of `detail` in the URL.

0 votes
Shushan Kocharyan February 24, 2023

I want to have PR link, can you help me?

0 votes
Khaled Badenjki February 10, 2022

It would be something like this:

https://{URL}/rest/dev-status/1.0/issue/details?issueId={ISSUE_ID}&applicationType=github&dataType=pullrequest

 

where ISSUE_ID is the ID, not the key

Fatin Kazi December 8, 2022

This worked for me previously but now im keep getting this.

 

{

    "errors": [],

    "detail": []

}
Anyone has any idea? is there still away to do it ?

Suggest an answer

Log in or Sign up to answer