Fetching Git Commits and Branches of an Issue from Jira

Erdem Tuna
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!
June 28, 2021

Hello,

 

My Jira Cloud instance is linked with Github. I want to access the git commits and branches of Jira issues by using REST API. I checked the REST API of Jira, as well as the links below, but I could not obtain the data over the REST API. How can I get this data?

Links:

- https://jira.atlassian.com/browse/JSWCLOUD-16901

https://community.atlassian.com/t5/Jira-questions/API-get-branches-related-to-issue/qaq-p/1214220

1 answer

1 accepted

2 votes
Answer accepted
Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 30, 2021

Hello @Erdem Tuna,

Welcome to Atlassian Community!

Thank you for sharing the feature request and community post.

As mentioned on the ticket, there is no public API to get the development information from Jira issues.

There are some endpoints that are currently, not supported, since they can change without notice. 

Can you try using the REST API call below?

https://your-domain.atlassian.net/rest/dev-status/latest/issue/detail?issueId=[ISSUE-ID]&applicationType=GitHub&dataType=repository

Other examples can be found in the description of the feature request:

Kind regards,
Angélica

Emre Açıkgöz
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!
June 30, 2021

Hi @Angélica Luz

I am still experiencing some problems accessing the development details of a project.

For example,

On an Apache Fineract issue, there is a pull request linked to the issue under the "links to" section. 
Issue link: [FINERACT-1089] Operation not allowed for a result set of type ResultSet.TYPE_FORWARD_ONLY in InterestRateChartReadPlatformServiceImpl - ASF JIRA (apache.org)

I am unable to reach the pull request URL from the public API of the Apache Jira
Public API link for this issue: https://issues.apache.org/jira/rest/api/2/issue/FINERACT-1089

 Using the id of the issue, I visit the two links below:
https://issues.apache.org/jira/rest/dev-status/latest/issue/summary?issueId=13316289

https://issues.apache.org/jira/rest/dev-status/latest/issue/detail?issueId=13316289&applicationType=GitHub&dataType=pullrequest

I get that Apache Jira doesn't use a GitHub integration app. So the results above are normal.

Is there any way that I would be able to get the linked pull request URL? I guess the main problem here is related to how they link their issues to GitHub.    

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 2, 2021

Hello @Emre Açıkgöz ,

Welcome to the Atlassian Community!

First of all let me mention that this question is related to Jira Cloud while you are actually pointing to a Jira Server (on-premise) site. Therefore, there are chances things are working slightly different in your case.

Indeed, the endpoints provided by @Angélica Luz are coming from the below Feature Request for Jira Software Cloud:

 

There is a similar FR open for Jira Server but it does not list the same workaround. So, there are chances the same endpoints could work in Jira Software Server as well but I am not 100% sure since those are anyway internal endpoints, not officially documented and not officially supported:

 

Finally, once this has been clarified, please notice that those internal REST API endpoints will only work if you have integrated Jira with Github following the below documentation, while it looks like you are doing something different:

 

This is because those internal REST API endpoints are just fetching the same information that is displayed in the development panel of an issue, while in your case you don't have the development panel at all. It looks like you just have a remote link to the GitHub PR:

WRONG.jpg

 

To Summarize:

  1. It is normal that you cannot fetch data from the development panel since there is none.
  2. If you want to test whether or not the same REST API endpoints provided as a workaround for Cloud work in Server too, you need to configure the integration with GitHub as explained in Integrating with Development Tools.

 

 

Cheers,
Dario

Like # people like this
Chintan Keraliya June 12, 2024

I got this error "Unauthorized; scope does not match" in this API

"https://issues.apache.org/jira/rest/dev-status/latest/issue/detail?issueId=13316289&applicationType=GitHub&dataType=pullrequest"


so how to solve it?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events