The 'issue comments' REST resource allows you to create, read, update, and delete bitbucket issue tracker comments. When you create, update, or delete an issue comment you must provide a username/password combination. To update and delete, you must either be the comment author or a user with admin permissions on the repo.
Overview
To list all the comments associated with issue 3210 on repository site/master:
$ curl https://api.bitbucket.org/1.0/repositories/site/master/issues/3210/comments/
[
{
"content": "I second this!\n\nAm going to implement the same kludge as Arothian..\n\nWas surprised to see that it wasn't implemented already.\n\nI am glad that you've got an API, of course. :)",
"author_info": {
"username": "jacmoe",
"first_name": "Jacob",
"last_name": "Moen",
"avatar": "https://secure.gravatar.com/avatar/cddd845778affc94b6f5913c57d1e96b?d=identicon&s=32",
"resource_uri": "/1.0/users/jacmoe"
},
"comment_id": 834548,
"utc_updated_on": "2011-12-03 04:29:49+00:00",
"utc_created_on": "2011-12-03 04:28:56+00:00",
"is_spam": false
},
{
"content": "Hi arothian,\r\n\r\nThats a good suggestion, I will add it to the backlog of issues around the REST API.\r\n\r\nCheers,\r\n\r\nDylan",
"author_info": {
"username": "detkin",
"first_name": "Dylan",
"last_name": "Etkin",
"avatar": "https://secure.gravatar.com/avatar/e1ef8ef737e394a17ffbc27c889c2b22?d=identicon&s=32",
"resource_uri": "/1.0/users/detkin"
},
"comment_id": 743643,
"utc_updated_on": "2011-10-27 18:20:21+00:00",
"utc_created_on": "2011-10-27 18:20:21+00:00",
"is_spam": false
},
{
"content": null,
"author_info": {
"username": "detkin",
"first_name": "Dylan",
"last_name": "Etkin",
"avatar": "https://secure.gravatar.com/avatar/e1ef8ef737e394a17ffbc27c889c2b22?d=identicon&s=32",
"resource_uri": "/1.0/users/detkin"
},
"comment_id": 743642,
"utc_updated_on": "2011-10-27 18:19:50+00:00",
"utc_created_on": "2011-10-27 18:19:50+00:00",
"is_spam": false
}
]
Getting an individual comment
If you specify the comment ID, you can get information on a single comment:
$ curl https://api.bitbucket.org/1.0/repositories/site/master/issues/3210/comments/743642/
{
"content": null,
"author_info": {
"username": "detkin",
"first_name": "Dylan",
"last_name": "Etkin",
"avatar": "https://secure.gravatar.com/avatar/e1ef8ef737e394a17ffbc27c889c2b22?d=identicon&s=32",
"resource_uri": "/1.0/users/detkin"
},
"comment_id": 743642,
"utc_updated_on": "2011-10-27 18:19:50+00:00",
"utc_created_on": "2011-10-27 18:19:50+00:00",
"is_spam": false
}
Adding a comment
To add a new comment, issue a POST request. The username you authenticate with becomes the comment author. The system populates the other info fields based on the username.
$ curl --request POST --user baratrion:password https://api.bitbucket.org/1.0/repositories/baratrion/test/issues/4/comments/ --data "content=Hello World"
{
"content": "Hello World",
"author_info": {
"username": "baratrion",
"first_name": "Mehmet",
"last_name": "Catalbas",
"avatar": "https://secure.gravatar.com/avatar/55a1369161d3a648729b59cabf160e70?d=identicon&s=32",
"resource_uri": "/1.0/users/baratrion"
},
"comment_id": 893636,
"utc_updated_on": "2011-12-21 01:02:43+00:00",
"utc_created_on": "2011-12-21 01:02:43+00:00",
"is_spam": false
}
Editing (updating) an existing comment
To edit a comment, issue a PUT request:
$ curl --request PUT --user baratrion:password https://api.bitbucket.org/1.0/repositories/baratrion/test/issues/4/comments/893636/ --data "content=Hello"
{
"content": "Hello",
"author_info": {
"username": "baratrion",
"first_name": "Mehmet",
"last_name": "Catalbas",
"avatar": "https://secure.gravatar.com/avatar/55a1369161d3a648729b59cabf160e70?d=identicon&s=32",
"resource_uri": "/1.0/users/baratrion"
},
"comment_id": 893636,
"utc_updated_on": "2011-12-21 01:05:35+00:00",
"utc_created_on": "2011-12-21 01:02:43+00:00",
"is_spam": false
}
If you have admin permissions on a repository, you can edit any comment on the repository's issue tracker. Otherwise, you can only edit your own comments.
Deleting a comment
To delete a comment, issue a DELETE request:
curl --request DELETE --user baratrion:password https://api.bitbucket.org/1.0/repositories/baratrion/test/issues/4/comments/893636/
If you have admin permissions on a repository, you can delete any comment on the repository's issue tracker. Otherwise, you can only delete your own comments.






2 Comments
Hide/Show CommentsDec 22, 2011
Anthony Steiner
I'm playing an epic song right now in light of this new API. Thank you very much BB/Atlassian Devs!!!!
Feb 05, 2012
Philip
You can also delete issue comment by open such URL:
http://bitbucket.org/USERNAME/REPONAME/issue/delete/ISSUE_NUMBER/COMMENT_NUMBER
Add Comment