You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I'm trying to post comments via bitbucket 2.0 api.
Where the doc can be found here:
However, I get "content.html": "extra keys not allowed" when I create a json where
content looks like:
{
"content“:{
"raw": "blablablabla",
"html": "blablablabla"
}
}
@stephen @Steph @Stephen Siferscould you kindly update us if the html content option really works. Otherwise I could switch to Jira or any other options because this is a big necessity for me. Thanks much @Tim Clipsham
You need to use markup: https://commonmark.org/help/
Example:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The only allowed value to send to Bitbucket API is `content.raw`.
I've tested this 2 minutes ago and it works like charm. Of course your content needs to be formatted as markdown.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for my case, it works too for the raw and the comment is saved ok. My problem is with html content. How do you do it, because the structure given by the documentation doesn't work. Tried something like
"content": {
"raw": "Just checking",
"markup": "markdown",
"html": "<h4>Just checking</h4>",
"type": "rendered"
}
As it is on the documentation, but doesn't work. This is very important for my case.
The result for my case is as shown in screenshot below, thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
AFAIK it only works with raw data (i.e. markdown). The HTML is rendered on bitbucket side.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How the raw data should be sent here then?
I sent a query as follow and got an error "extra keys not allowed".
The API error message does not provide any meaningful error and the documentation does not help in any way. Which is why so many people are asking here.
Thanks.
"content": {
"raw": "# Comment",
"markup": "markdown"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"content": {
"raw": "# Comment"
}
Like that ;).
Yes, the extra key "markup" is not allowed to be sent to the API endpoint. Thus it needs to be omitted.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok so the server infers the content type then.
I am wondering how this is possible to have a lack of documentation on this?
Thanks a lot for your answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Chen and welcome to the Community!
When using the REST API to create a comment within a pull request you must ensure your HTML comment is rendered as HTML. Meaning you must ensure that the comment itself is structured using HTML. An example of a test comment would look as follows:
"content": {"raw": "This is a test comment for HTML testing.", "markup": "markdown", "html": "<p>This is a test comment for HTML testing.</p>", "type": "rendered"}
Notice here that the HTML is not plain text and is rendered as HTML itself.
I hope this proves helpful and you’re able to POST your comments to your pull request soon!
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Stephen, the example seems not working, it stills shows
{
"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"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
your example gives..
{"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"}}
Can you please post an example that works?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Stephen Sifers
I am seeing the same issue as the posters above, and never saw a response.
I am posting the following JSON to
https://api.bitbucket.org/2.0/repositories/<username>/<slug>/pullrequests/<pull_request_id>/comments
:
{
"content": {
"raw": "This is a test comment for HTML testing.",
"markup": "markdown",
"html": "<p>This is a test comment for HTML testing.</p>",
"type": "rendered"
}
}
And receiving the following 400 Response:
{
"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"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same issue, so the endpoint rules doesn't represent what the doc says.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am facing the same issue.
The json i am sending as payload is:-
{
"content": {
"raw": "Just checking",
"markup": "markdown",
"html": "<p>Just checking</p>",
"type": "rendered"
}
}
I am getting the below output:-
{ "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" }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the provided solution never worked and no response was provided to the comments
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
+1 here. Any update on this issue? Seems the API is broken for quite some time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try sending only the raw value. Apparently that's how Bitbucket does it on their interface.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you mind sending the full request to see the other values of your request?
In particular, what do you put for `markup` and `type` attributes?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's the point. You don't send them.
Have a look here: https://github.com/mc1arke/sonarqube-community-branch-plugin/pull/105/commits/32087bf2cd3161a5258b194ff35c6b0cc3306817#diff-f9ea34fbcca013ab311235823e0bca99R109
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.