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: <computed>\n force_destroy: "false"\n location: "AUSTRALIA-SOUTHEAST1"\n name: "defaultt"\n project: "fulfillment-test-env"\n self_link: <computed>\n storage_class: "STANDARD"\n url: <computed>\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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.