I would like to find all pull requests for a Jira issue. Obviously, this is a possible task, as Jira itself shows the information:
Currently, I retrieve a list of all merged and open pull requests via the Bitbucket API, and pattern match these to my issue number. This is time consuming, even more so as I have to load the pull requests in batches of 100 (Max limit in Bitbucket), and we have our code spread in several repositories.
There is an integration api call to bitbucket: /rest/jira/1.0/issues//commits, which will show all commits to this issue, but .../pullrequests is not available.
Does anyone know, how Jira retrieves this information?
https://github.com/jira-node/node-jira-client/issues/142
JIRA has an undocumented "dev-status" API that is usual when JIRA is integrated with other tools like Stash (Bitbucket Server)
At first you have to get jiraIssueNumericId. For example you can get it by getting issue info via Jira API that is well documented. The field you are looking for is "id". https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/?_ga=2.203378385.1940451621.1522669776-298439511.1476796418#api/2/issue-getIssue)
About methods of this Jira dev-status API:
https://{jiraHost}/rest/dev-status/latest/issue/detail?issueId={jiraIssueNumericId}&applicationType=stash&dataType=pullrequest
https://{jiraHost}/rest/dev-status/latest/issue/detail?issueId={jiraIssueNumericId}&applicationType=stash&dataType=repository
https://{jiraHost}/rest/dev-status/latest/issue/summary?issueId={jiraIssueNumericId}
P.S. This API is actually used on issue page in Jira. Try clicking on pull-requests link to open popup window with a list of them. In development panel of your browser in Network tab you will find XHR-calls or these urls.
P.P.S. And yes, I've also struggled to find this info and I have no idea why it is undocumented.