Can't create comment on pull request via API

Hi!
I’m trying to add some comments to a PR via the v2 API. I’ve been looking at other threads such as this one, but no such luck. I’ve been able to use the API for looking up and deleting comments, but nothing seems to work for posting new comments. Here is an example of what I’m seeing when I try to create a comment:

curl -v -X POST https://api.bitbucket.org/2.0/repositories/<user>/<repo>/pullrequests/169/comments -H 'Content-Type: application/json' -H 'Authorization: Bearer <access_key>' -d "{'content': {'raw': 'your comment'}}"
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 18.205.93.8...
* TCP_NODELAY set
* Connected to api.bitbucket.org (18.205.93.8) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=Atlassian, Inc.; OU=Bitbucket; CN=*.bitbucket.org
*  start date: Jun 12 00:00:00 2017 GMT
*  expire date: Jun 16 12:00:00 2020 GMT
*  subjectAltName: host "api.bitbucket.org" matched cert's "*.bitbucket.org"
*  issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7f8914806600)
> POST /2.0/repositories/<user>/<repo>/pullrequests/169/comments HTTP/2
> Host: api.bitbucket.org
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer <theaccesskey>
> Content-Length: 36
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
* We are completely uploaded and fine
< HTTP/2 400
< server: nginx
< vary: Authorization
< content-type: text/plain
< x-oauth-scopes: webhook, pullrequest:write, repository:admin, team, account
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< date: Thu, 28 Nov 2019 04:05:11 GMT
< x-served-by: app-1141
< x-static-version: 17f8660d50c1
< x-credential-type: oauth2
< x-render-time: 0.016991853714
< x-accepted-oauth-scopes: pullrequest
< x-version: 17f8660d50c1
< x-reads-before-write-from: default
< x-frame-options: SAMEORIGIN
< x-request-count: 2343
< content-length: 11
<
* Connection #0 to host api.bitbucket.org left intact
Bad Request

Hi @BenNelson,
I think your error is because of wrong quotes.
Try replacing the body content with this (I swapped the " and ');

-d '{"content": {"raw": "your comment"}}'

That was it! Thanks so much!

Well, this is commenting on behalf of the user, not the addon. How can I show the commenter name as addon name, not the username?