Currently comments can only be added to the overall section of a PR. The Bitbucket Data Center REST API supports adding comments to specific lines within a file by using the "anchor" field. The Bitbucket Cloud REST API uses an "inline" field.
Example Bitbucket Data Center:
General file comment:
{
"text": "An insightful general comment on a file.",
"anchor": {
"diffType": "RANGE",
"fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd",
"path": "path/to/file",
"srcPath": "path/to/file",
"toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b"
}
}
File line comment:
{
"text": "A pithy comment on a particular line within a file.",
"anchor": {
"diffType": "COMMIT",
"line": 1,
"lineType": "CONTEXT",
"fileType": "FROM",
"fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd",
"path": "path/to/file",
"srcPath": "path/to/file",
"toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b"
}
}
Example Bitbucket Data Center:
"inline": {
"from": 57,
"to": 122,
"path": "<string>"
},
Currently comments can only be added to the overall section of a PR. The Bitbucket Data Center REST API supports adding comments to specific lines within a file by using the "anchor" field. The Bitbucket Cloud REST API uses an "inline" field.
Example Bitbucket Data Center:
General file comment:
{ "text": "An insightful general comment on a file.", "anchor": { "diffType": "RANGE", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } }File line comment:
{ "text": "A pithy comment on a particular line within a file.", "anchor": { "diffType": "COMMIT", "line": 1, "lineType": "CONTEXT", "fileType": "FROM", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } }Example Bitbucket Data Center: