Missed Team ’24? Catch up on announcements here.

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

adding comment on PR from CLI

Yamini December 3, 2018

Hi Team, 

I am trying to add a comment on my PR from CLI using bit bucket 2.0 api, it worked fine but I want to add my comment as code block wondering how to  do that?

I have followed the below curl command to get my API work, could you please suggest how can I change my comment as code block ?

-----------------

 

$ cat comment_test.txt
{
"content": {
"raw": "This is a test of the auto comment\n\nSecond line."
}
}

---------------------

curl -v -X POST -H "Content-Type: application/json" -u <username>:<passwd> -d @Comment_test.txt https://bitbucket.org/api/2.0/repositories/twgnz/<repositoryname>/pullrequests/<PR number>/comments

 I have tried as below, but its throwing an error

 {
"content":{
"raw":"```plaintext\n\u001b[32m \u001b[32m+\u001b[0m \u001b[32mgoogle_storage_bucket.image-store\r\n\u001b[0m id: <computed>\r\n force_destroy: \"false\"\r\n location: \"AUSTRALIA-SOUTHEAST1\"\r\n name: \"default-twg-test-bucket\"\r\n project: \"fulfillment\"\r\n self_link: <computed>\r\n storage_class: \"STANDARD\"\r\n url: <computed>\r\n+\u001b[0m\r\n+\u001b[0m\n```",
"markup":"markdown",
"html":"<div class=\"codehilite language-plaintext\"><pre><span></span>\u001b[32m \u001b[32m+\u001b[0m \u001b[32mgoogle_storage_bucket.image-store\n\u001b[0m id: &lt;computed&gt;\n force_destroy: &quot;false&quot;\n location: &quot;AUSTRALIA-SOUTHEAST1&quot;\n name: &quot;defaultt&quot;\n project: &quot;fulfillment-test-env&quot;\n self_link: &lt;computed&gt;\n storage_class: &quot;STANDARD&quot;\n url: &lt;computed&gt;\n+\u001b[0m\n+\u001b[0m\n</pre></div>",
"type":"rendered"
}
}

 

Error - {"type": "error", "error": {"fields": {"content.html": "extra keys not allowed", "content.markup": "extra keys not allowed", "content.type": "extra keys not allowed"}, "message": "Bad request"}}

 


Collapse 

 

1 answer

0 votes
Julien Delange February 22, 2020

Any update on this issue? This is still happening

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events