pullrequests Resource 1.0

Still need help?

The Atlassian Community is here for you.

Ask the community

Overview

Manage the comments on pull requests. Other users can reply to them. This allows for the construction of a thread of comments. 

GET a list of a pull request comments DEPRECATED

Gets the array of comments on the specified request. A request comment has the following fields:

Field Description
pull_request_id An integer representing an id for the request. This is created by Bitbucket.
comment_id An integer representing an id for the comment. This is created by Bitbucket.
parent_id An integer representing an id for the comment's. This  This is created by Bitbucket.
utc_last_updated A Universal Timestamp Coordinate timestamp for the last time the comment was updated.
filename_hash Currently not used.
base_rev The revision where the changeset originated.
filename The filename the new comment concerns.
content The content of the comment.
content_rendered The content including the HTML and other formatting material.
author_info The account profile of the user that added the comment. Only Bitbucket account holders can comment on requests.
line_from The starting line of the comment.
line_to The ending line of the comment.
dest_rev The revision representing the destination source.
utc_created_on A Universal Timestamp Coordinate timestamp for the comment creation.
anchor Currently not used.
is_spam A boolean indicating if the request is spam or not. The Bitbucket service uses Akismet to protect its users from spam. When Akismet indicates a comment may be spam, Bitbucket sets is_spam to true.

For private repositories, the caller must authenticate as a user with authorization to view the repository.

GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/pullrequests/{pull_request_id}/comments
Click here to expand...
[
    {
        "pull_request_id": 672,
        "comment_id": 14352,
        "parent_id": null,
        "deleted": false,
        "utc_last_updated": "2012-08-12 18:48:01+00:00",
        "filename_hash": null,
        "base_rev": "174eecac678c",
        "filename": null,
        "content": "I can't pull from a deleted repository. I'll have to delete this request. Thank you for working through t
he tutorial.",
        "content_rendered": "<p>I can't pull from a deleted repository. I'll have to delete this request. Thank you for worki
ng through the tutorial.</p>\n",
        "author_info": {
            "username": "tutorials",
            "first_name": "",
            "last_name": "",
            "is_team": false,
            "avatar": "https://secure.gravatar.com/avatar/0bc5bd490000b8e63c35c0f54e667b9e?d=identicon&s=32",
            "resource_uri": "/1.0/users/tutorials"
        },
        "line_from": null,
        "line_to": null,
        "dest_rev": "101f16a95c13",
        "utc_created_on": "2012-08-12 18:48:01+00:00",
        "anchor": "a18fd07465b5",
        "is_spam": false
    }
]

GET an individual pull request comment DEPRECATED

Gets an individual comment on an request. Private repositories require authorization with an account that has appropriate access.

GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}
Click here to expand...
{
    "pull_request_id": 672,
    "comment_id": 14353,
    "parent_id": 14352,
    "deleted": false,
    "utc_last_updated": "2012-08-12 18:54:53+00:00",
    "filename_hash": null,
    "base_rev": "174eecac678c",
    "filename": null,
    "content": "This is a reply.",
    "content_rendered": "<p>This is a reply.</p>\n",
    "author_info": {
        "username": "tutorials",
        "first_name": "",
        "last_name": "",
        "is_team": false,
        "avatar": "https://secure.gravatar.com/avatar/0bc5bd490000b8e63c35c0f54e667b9e?d=identicon&s=32",
        "resource_uri": "/1.0/users/tutorials"
    },
    "line_from": null,
    "line_to": null,
    "dest_rev": "101f16a95c13",
    "utc_created_on": "2012-08-12 18:54:53+00:00",
    "anchor": "a18fd07465b5",
    "is_spam": false
}

POST a new comment

Creates a new comment on an request using the specified content data. The caller must be authenticated and have access to the repository to create an request. 

POST https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/pullrequests/{pull_request_id}/comments --data "content=string"
Click here to expand...
{
    "username": "tutorials",
    "pull_request_id": 672,
    "comment_id": 14356,
    "display_name": "tutorials",
    "parent_id": null,
    "deleted": false,
    "utc_last_updated": "2012-08-12 20:04:38+00:00",
    "filename_hash": null,
    "base_rev": "174eecac678c",
    "filename": null,
    "content": "This is yet another comment",
    "content_rendered": "<p>This is yet another comment</p>\n",
    "user_avatar_url": "https://secure.gravatar.com/avatar/0bc5bd490000b8e63c35c0f54e667b9e?d=identicon&s=32",
    "line_from": null,
    "line_to": null,
    "dest_rev": "101f16a95c13",
    "utc_created_on": "2012-08-12 20:04:38+00:00",
    "anchor": "a18fd07465b5",
    "is_spam": false
}

PUT an update on a comment

Updates a comment on an request using the specified content data. The caller must be authenticated as a user that created the comment or as a user with administrative rights on the repository.

PUT  https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id} --data "content=string"
Click here to expand...
{
    "username": "tutorials",
    "pull_request_id": 672,
    "comment_id": 14356,
    "display_name": "tutorials",
    "parent_id": null,
    "deleted": false,
    "utc_last_updated": "2012-08-12 20:04:38+00:00",
    "filename_hash": null,
    "base_rev": "174eecac678c",
    "filename": null,
    "content": "This is an update to my comment.",
    "content_rendered": "<p>This is an update to my comment.</p>\n",
    "user_avatar_url": "https://secure.gravatar.com/avatar/0bc5bd490000b8e63c35c0f54e667b9e?d=identicon&s=32",
    "line_from": null,
    "line_to": null,
    "dest_rev": "101f16a95c13",
    "utc_created_on": "2012-08-12 20:04:38+00:00",
    "anchor": "a18fd07465b5",
    "is_spam": false
}

DELETE a pull request comment

Delete the comment with the corresponding comment_id. The caller must be authenticated as a user that created the comment or as a user with administrative rights on the repository.


DELETE  https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}
Click here to expand...
{
    "pull_request_id": 672,
    "comment_id": 14356,
    "deleted": true,
    "filename_hash": null,
    "base_rev": "174eecac678c",
    "filename": null,
    "parent_id": null,
    "line_from": null,
    "line_to": null,
    "dest_rev": "101f16a95c13",
    "anchor": "a18fd07465b5",
    "is_spam": false
}

A successful deletion returns HTTP/1.1 200 OK.

Toggle spam flag on an existing pull request comment

Toggles the spam flag on a pull request comment identified by the pull_request_id. This call requires authentication. This call takes the following parameters:

Parameter Required? Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
pull_request_id Yes The pull_request_id changeset identifier.
comment_id Yes The comment identifier.
PUT https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/pullrequests/{pull_request_id}/comments/spam/{comment_id
Click here to expand...
 {
    "username": "auserbb",
    "node": "abdeaf1b2b4a",
    "comment_id": 25720,
    "display_name": "A User",
    "parent_id": 25711,
    "deleted": false,
    "utc_last_updated": "2012-07-24 21:39:12+00:00",
    "filename_hash": "36e1237b957fa2002d264c5fd031c547",
    "filename": "Readme",
    "content": "what the eff",
    "content_rendered": "<p>what the eff</p>\n",
    "user_avatar_url": "https://secure.gravatar.com/avatar/49bd0ee69e520e8bc250adb95710bbb8?d=identicon&s=32",
    "line_from": 3,
    "line_to": 6,
    "utc_created_on": "2012-07-24 21:06:33+00:00",
    "is_spam": false
}


Last modified on May 26, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.