Reputation: 103
I'm using both JIRA and Stash REST APIs for reading data from our systems, but I wasn't successful in finding out how to get JIRA issue(s) associated with a given pull request. I can easily get the pull request's from branch, so getting issue(s) associated with a given branch would work, too.
I know how to get pull request(s) associated with a given issue, that is, the other way around, but obviously I cannot scan all the issues. Also, the web interface shows the info, but I'd like to avoid using that programmatically. Surely there is a way using the API?
Upvotes: 2
Views: 1807
Reputation: 3670
There is this REST resource to retrieve the JIRA issues for a pull request:
/rest/jira/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/issues
Its response looks like:
[
{
"key": "JRA-11",
"url": "https://jira.atlassian.com/browse/JRA-11"
},
{
"key": "JRA-9",
"url": "https://jira.atlassian.com/browse/JRA-9"
}
]
It is available both for Stash and Bitbucket.
Upvotes: 2