Am trying to retrieve the JIRA ID referenced on the Stash Pull Request UI display (JIRA Issue). This Curl call: curl -k -D- -u <JiraUser> -X GET -H \'Content-Type: application/json\' \'https://localhost:8443/rest/api/1.0/projects/<project>/repos/<repository>/pull-requests/4379/activities?limit=1000' can return "attributes:{"jira-key": but does not appear to actually return the JIRA Issue linked to on the Pull Request page.
Hi @Danny Powell,
I believe what you are looking for is the bitbucket-JIRA REST API. (The docs I've linked are Stash docs, as the Bitbucket Server docs are currently broken. I'm working on fixing that right now!)
Basically you can call:
/rest/jira/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/issues
and will receive a response similar to:
[ { "key": "JRA-11", "url": "https://jira.atlassian.com/browse/JRA-11" }, { "key": "JRA-9", "url": "https://jira.atlassian.com/browse/JRA-9" } ]
I hope that helps,
Felix HaehnelGraduate DeveloperBitbucket Server
That did it! Thank you for the help. That was exactly what I needed.
Hi,
Is there any Java Method to get all the JIRA issues associated with the PR? Pls help.
@Senthil Jothi,
there sure is:
com.atlassian.bitbucket.integration.jira.JiraIssueService exposes the method <a href="https://developer.atlassian.com/static/javadoc/bitbucket-server/4.6.0/jira-api/reference/com/atlassian/bitbucket/integration/jira/JiraIssueService.html#getIssuesForPullRequest(int,%20long)" rel="nofollow noopener noreferrer">getIssuesForPullRequest(int, long)</a>.
com.atlassian.bitbucket.integration.jira.JiraIssueService
<a href="https://developer.atlassian.com/static/javadoc/bitbucket-server/4.6.0/jira-api/reference/com/atlassian/bitbucket/integration/jira/JiraIssueService.html#getIssuesForPullRequest(int,%20long)" rel="nofollow noopener noreferrer">getIssuesForPullRequest(int, long)</a>
You will also need to add the following dependency to your pom.xml:
pom.xml
<dependency> <groupId>com.atlassian.bitbucket.server</groupId> <artifactId>bitbucket-jira-api</artifactId> <scope>provided</scope> </dependency>
Thank you soo much.
Last question,
Is there any method to add more issues to the same list ?
This does not appear to work in JIRA Server 7.2.1 with Bitbucket Server 4.9.1. I can't see to find anyway to link either Issues to Pull-requests or vice versa.
It looks like you're new here. Sign in or register to get started.