How to get JIRA ticket url from Bitbucket Pull Request

Anil Mishra
Contributor
October 22, 2023

I'm writing a plugin and wanted to pull all Jira ticket along with their url (multiple Jira instance are linked to my bitbucket data center). and export it

Currently I'm calling pull request api is which is returning internal url which can be resolved from browser but I'm looking for exact url or way to get Jira ticket url out of it.

 

https:/bitbucket-host/bitbucket/rest/jira/latest/projects/JIR/repos/icgjira/pull-requests/30/issues
This just returning 
[
    {
        "key""BOP-967",
    },
    {
        "key""C1311-9",
    }
]
here both url belong to different Jira instance and I don't see any way to get Jira url for issue.
Please help.
Thanks,
Anil

1 answer

0 votes
Anil Mishra
Contributor
October 24, 2023

I see some workaround by calling below bitbucket rest api

/rest/jira-integration/latest/issues?issueKey=C1311-9&fields=url

"url":"https:\/\jira.atlassian.com/\/jira\/browse\/C1311-9"

Read url value from the response json, it will give Jira URL for provided ticket.

 

If anyone have more simpler solution or using Java API, kindly suggest.

Suggest an answer

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

Atlassian Community Events