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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Add comments to Pull Requests from API

How to add comment to Pull Request in Stash REST API? REST API Browser doesn't help.

1 answer

1 accepted

1 vote
Answer accepted

Hi nfx,

Yeah I'm afraid our REST documentation is lacking at the moment. We are looking to update them in an upcoming release.

To add a comment via REST:

http://host:port/rest/api/latest/projects/$PROJECT/repos/$REPO/pull-requests/$PR/comments

curl -X POST -d '{"text":"your comment"}' $URL

Or if you're replying

curl -X POST -d '{"text":"your comment","parent":{"id":1061}}' $URL

I hope this helps,

Charles

Hello Charles,

I've already figured that out. Somehow. But thank you :)

Btw, Rest Api Browser when used with parameters that are already in URL is totally unusable for playing with API. would you fix that someday?)

Hi nfx,

As I said - we are looking to improve the REST documentation this year. The REST browser will updated alongside Stash as new versions are released.

Charles

I tried this but comments not updated in Bitbucket cloud. There is none of the message displayed and no error. 

Used 2.0 api, the GET comments works fine.

-Kannan

Hi Charles,

Can you let me know what is $PR in hyperlink format you have provided

HI All ,

 

Getting the below error when trying to add the commnet to a PR as

 curl -k -u ******:***** -X POST -d '{"content": { "raw": "your comment" }}' https://api.bitbucket.org/2.0/repositories/**/********/pullrequests/1/comments

 

"type": "error", "error": {"fields": {"content": "required key not provided", "{\"content\": { \"raw\": \"your comment\" }}": "extra keys not allowed"}, "message": "Bad request"}

 

Any idea what am i missing here

Like # people like this

I'm receiving the same error as ranjan

aphex3k  my issue is resolved after I added the content-type param to the url , pls try the same

Like # people like this

I had to add `Content-Type: application/json` to headers, not the URL. Maybe either is good enough.

Suggest an answer

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

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

466 views 4 4
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