How to fetch comments from pull-requests?

Suresh Sakhare
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2018

As mention in bibucket server REST api documentation link. I am trying to fetch the comments.

(/rest/api/1.0/projects/OTP/repos/otplanner/pull-requests/20/comments?ANCHORSTATE="ALL"&DIFFTYPE="EFFECTIVE"

 

It gives me below error

{
"errors": [
{
"context": null,
"message": "The path query parameter is required when retrieving comments.",
"exceptionName": null
}
]
}

 Suggest on this

1 answer

1 accepted

1 vote
Answer accepted
Prasanth
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 5, 2018

Hi Suresh,

The message in the response suggests that you are missing the path. Please note the "comments" endpoint can't be used without the path variable.  For example following

PROJECT_1/repos/rep_1/pull-requests/1/comments?path=add_file/add_file.txt  can be used to retrieve the comments for the file add_file.txt in add_file folder.

If you are looking for general pull request comments then I would suggest using activities.

Hope this helps.

Best regards,
Prasanth Thaikkalloor

Suresh Sakhare
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2018

Thanks Prasanth.

Can we set the author of the comment while creating comment from REST API for cloud.

I tried it but, it alwas set API call executer user.

 {

"parent": {
"id": 75136852
},


"content": {
"raw": "Test reply comments from api"

},
"user": {
"username": "xxx",
"display_name": "xxx 007"


},
"inline": {

"path": "test"
}


}

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events