The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Rest API: GET Pull Request Comments is always empty

Noha Khater
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 9, 2024

I'm trying to retrieve all pull request comments via the rest api but the result is always empty, even though the pull request clearly does have comments.

I'm using this endpoint but I don't understand how to provide a "set of field values". Simply calling the endpoint as is 

http://{baseurl}/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments

returns 

{
"size": 0,
"limit": 25,
"isLastPage": true,
"values": [],
"start": 0
}

 What am I missing?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Avinash Tingre
May 16, 2024

Hi @Noha Khater ,

Are you trying to get normal comments or blocker comments (tasks)? The API you mentioned is for fetching blocker comments from the PR.

I am able to get the response properly from the same API. But this only fetches blocker comments, not the normal comments.

There is separate API for fetching normal comments (path is mandatory to pass):

curl --location --request GET 'https://{{bitbucket-host}}/rest/api/latest/projects/{projectKey}/repos/{repo-key}/pull-requests/{pull-request-id}/comments?start=0&limit=300&path=src/main/java/com/avinash/MyFile.java' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}'
DEPLOYMENT TYPE
SERVER
VERSION
8.12
TAGS
AUG Leaders

Atlassian Community Events