I'm using Bitbucket API (2.0) to submit comments to Pull Rrequests but I'm having a hard time figuring out how to send "styled" comments either using Markdown or HTML.
I've only managed to send comments in raw mode so far.
This is the documentation
This is the code that sends raw messages:
BITBUCKET_API_ROOT="https://api.bitbucket.org/2.0"
BITBUCKET_STATUS_API="$BITBUCKET_API_ROOT/repositories/$BITBUCKET_NAMESPACE/$BITBUCKET_REPOSITORY/pullrequests/$PR_ID/comments"
MESSAGE="this is my message."
echo "Pushing comment to $BITBUCKET_STATUS_API..."
curl --request POST $BITBUCKET_STATUS_API \
--user $BITBUCKET_USERNAME:$BITBUCKET_ACCESS_TOKEN \
--header "Content-Type:application/json" \
--silent \
--data "{\"content\": { \"raw\": \"$MESSAGE\" }}"
Trying to specify markdown, this way:
--data "{\"content\": { \"raw\": \"$MESSAGE\", \"markup\": \"markdown\" }}"
results in:
{"type": "error", "error": {"fields": {"content.markup": "extra keys not allowed"}, "message": "Bad request"}}
Trying other things, like specifying the html field also didn't help.