Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,093
Community Members
 
Community Events
165
Community Groups

REST API to get JIRA issue created from Bitbucket pull-request comment?

What I need to do is retrieve the JIRA issue created via the "Create issue" option in a pull request's comment  

example.PNG

This seems to be related to Bitbucket / JIRA integration.

I saw an almost similar post but it wasn't quite the same:  (it is retrieving the issues for which commits were made).  It seems to use this API.

I would expect to need to pass the comment ID to an API and get it somehow but can't find the option.  An option to create the issue is here with a POST.  I expected a related GET.

Thank you.  Hopefully you can point me to what I missed.

1 answer

1 accepted

0 votes
Answer accepted

Hi @Barry Robertson 

You should be able to request the Pull Request comment using the "/comments" resource by using the comment ID .e.g:

/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}

The response will contain the "properties" map with the "issues" key, e.g.:

{
"properties": {
"repositoryId": 1234,
"issues": ["JIRAKEY-123"]
}
// The rest of the response
}

The "issues" field might be undefined if there are no Jira issues created for the comment:

{
"properties": {
"repositoryId": 1234,
}

// The rest of the response
}

Link to docs for "comments" resource: https://docs.atlassian.com/bitbucket-server/rest/7.14.0/bitbucket-rest.html#idp331

Please be aware that the documentation page doesn't reference the "issues" field.

Thanks,

Maciej Adamczak
Atlassian Developer

Like Maciej Adamczak likes this

@Maciej Adamczak , would you happen to know the corresponding answer for Crucible?  I have the Bitbucket one working per your suggestion but now need to address Crucible reviews.  I saw this https://jira.atlassian.com/browse/CRUC-7902 issue but a suggested workaround there wasn't quite the answer I need.   Thanks again for the pointer on Bitbucket..

Sorry, but I don't know how that works in Crucible.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,222 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you