Rest API for getting list of jira issues present in PR on Bitbucket cloud
Asked by Arun Jagtap:

Below API is available for Bitbucket Server and is not present in Bitbucket cloud.  

<br />

<br />

> ```
> GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/issues
>
> Retrieves Jira issue keys that are associated with the commits in the specified pull request. The number of commits checked for issues is limited to a default of 100.
>
> Request
>
> ```
>
> ##### PATH PARAMETERS {#toc-hId--1623859405}
>
> **projectKey** REQUIRED
>
> string  
> The project key  
> **pullRequestId** REQUIRED
>
> string  
> The pull request id  
> **repositorySlug** REQUIRED
>
> string  
> The repository slug
>
> ```
>
>
> ```
>
> We wanted the similar information about the Jira issues present in the raised pull request.  
>
> There isn't anything on this in the documentation, but let me know if it's already there or something related to it.


Answers:
author: Nemanja Trivic
body: The only relatively practical solution i know of is to parse jira ID from PR name yourself.

I assume you are getting PR ID from bitbucket pipelines. So using this endpoint you can get PR title:

```
https://bitbucket.org/!api/2.0/repositories/{workspace_slug}/{repository_slug}/pullrequests/{pr_id} 
```

Here is the regex pattern used for parsing issue IDs <https://confluence.atlassian.com/bitbucketserverkb/integrating-with-custom-jira-issue-key-in-bitbucket-server-779171880.html>

So when u parse issue ID from PR title you can just hit Jira API endpoint like this:

```
/rest/api/2/issue/{issue_id}
```

comments: author: Arun Jagtap
body: Hey Thanks for reply [@Nemanja Trivic](/t5/user/viewprofilepage/user-id/5063811) ,  

yeah we have used similar kind of workaround for that.  

as Bitbucket cloud API would have make more sense of us instead by creating such workaround.  
so looking forward availability of desired API.


author: Theodora Boudale
body: Hi Arun,

I'm afraid that we don't have an API endpoint to get Jira issues associated with a PR. You can find those issues on the website only at the moment while viewing a certain PR, on the right-hand panel titled **Details**.

We have a feature request to provide such an API endpoint: <https://jira.atlassian.com/browse/BCLOUD-20183>

The request has been closed due to inactivity, but I would suggest leaving a comment there and adding your vote (by selecting the Vote for this issue link), as our product managers continue to monitor even closed requests.

Kind regards,  
Theodora

comments: author: Arun Jagtap
body: Thanks for Reply [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)   

sure I'll add it.


author: Theodora Boudale
body: You are very welcome, please feel free to reach out if you ever need anything else.


author: Arush Soel
body: Below API is available for Bitbucket Server and is not present in Bitbucket cloud.

Is there any update regarding its cloud api endpoint?

comments: author: Arush Soel
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) wanted a cloud api to find jira issues associated with a pr?


author: Theodora Boudale
body: Hi [@Arush Soel](/t5/user/viewprofilepage/user-id/5115791),

It is not possible to get Jira issues associated with a PR via API in Bitbucket Cloud.

Please add a comment to the following feature request to express your interest: <https://jira.atlassian.com/browse/BCLOUD-20183>

Kind regards,  
Theodora


Tags: api

bitbucket-cloud

cloud

issue

pull-request

rest