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?
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}'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.