Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

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}'

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.12
TAGS
AUG Leaders

Atlassian Community Events