I have a Bitbucket Server and I'm trying to figure out how to react to PR comments via the REST API. I'm referencing this documentation. The example shows:
curl --request PUT \
--url 'http://{baseurl}/rest/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/reactions/{emoticon}' \
--header 'Accept: application/json'
But I don't know what it's looking for, for {emoticon}
do I send a literal emoticon in the URL? Do I use the Unicode value? The value in the documentation just says string
, which isn't very helpful for emoticons.
I'm using PowerShell (Invoke-RestMethod
) so I tried these values for {emoticon}
:
[char]0x1F602
[convert]::ToInt32("1F602", 16)
[char]::ConvertFromUtf32([convert]::ToInt32("1F602", 16))
All of them got various errors like 400 Bad Request
.
But aside from the PowerShell piece, if anyone could give insight as to what sort of input they're actually looking for, I could figure out how to do it in PowerShell.
After some troubleshooting, it seems it's looking for names of the emoticons. So this:
Invoke-RestMethod -Method PUT -Uri 'http://{baseurl}/rest/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/reactions/heart
Adds a heart. "smile" adds a smile. But then "laugh" doesn't work but "laughing" does. So now I just need to figure out which names Bitbucket uses for all the rest of the emoticons, or find a list somewhere.