
Comments
********


Get Comments
============

This allows you to get data about comments, given a bug ID or comment
ID.

**Request**

To get all comments for a particular bug using the bug ID or alias:

   GET /rest/bug/(id_or_alias)/comment

To get a specific comment based on the comment ID:

   GET /rest/bug/comment/(comment_id)

+-----------------+----------+--------------------------------------------------------+
| name            | type     | description                                            |
+=================+==========+========================================================+
| **id_or_alias** | mixed    | A single integer bug ID or alias.                      |
+-----------------+----------+--------------------------------------------------------+
| **comment_id**  | int      | A single integer comment ID.                           |
+-----------------+----------+--------------------------------------------------------+
| new_since       | datetime | If specified, the method will only return comments     |
+-----------------+----------+--------------------------------------------------------+

**Response**

   {
     "bugs": {
       "35": {
         "comments": [
           {
             "time": "2000-07-25T13:50:04Z",
             "text": "test bug to fix problem in removing from cc list.",
             "bug_id": 35,
             "count": 0,
             "attachment_id": null,
             "is_private": false,
             "tags": [],
             "creator": "user@bugzilla.org",
             "creation_time": "2000-07-25T13:50:04Z",
             "id": 75
           }
         ]
       }
     },
     "comments": {}
   }

Two items are returned:

"bugs" This is used for bugs specified in "ids". This is an object,
where the keys are the numeric IDs of the bugs, and the value is a
object with a single key, "comments", which is an array of comments.
(The format of comments is described below.)

Any individual bug will only be returned once, so if you specify an ID
multiple times in "ids", it will still only be returned once.

"comments" Each individual comment requested in "comment_ids" is
returned here, in a object where the numeric comment ID is the key,
and the value is the comment. (The format of comments is described
below.)

A "comment" as described above is a object that contains the following
items:

+---------------+----------+----------------------------------------------------------+
| name          | type     | description                                              |
+===============+==========+==========================================================+
| id            | int      | The globally unique ID for the comment.                  |
+---------------+----------+----------------------------------------------------------+
| bug_id        | int      | The ID of the bug that this comment is on.               |
+---------------+----------+----------------------------------------------------------+
| attachment_id | int      | If the comment was made on an attachment, this will be   |
+---------------+----------+----------------------------------------------------------+
| count         | int      | The number of the comment local to the bug. The          |
+---------------+----------+----------------------------------------------------------+
| text          | string   | The actual text of the comment.                          |
+---------------+----------+----------------------------------------------------------+
| creator       | string   | The login name of the comment's author.                  |
+---------------+----------+----------------------------------------------------------+
| time          | datetime | The time (in Bugzilla's timezone) that the comment was   |
+---------------+----------+----------------------------------------------------------+
| creation_time | datetime | This is exactly same as the "time" key. Use this field   |
+---------------+----------+----------------------------------------------------------+
| is_private    | boolean  | "true" if this comment is private (only visible to a     |
+---------------+----------+----------------------------------------------------------+


Create Comments
===============

This allows you to add a comment to a bug in Bugzilla.

**Request**

To create a comment on a current bug.

   POST /rest/bug/(id)/comment

   {
     "comment" : "This is an additional comment",
     "is_private" : false
   }

+-------------+---------+-------------------------------------------------------------+
| name        | type    | description                                                 |
+=============+=========+=============================================================+
| **id**      | int     | The ID or alias of the bug to append a comment to.          |
+-------------+---------+-------------------------------------------------------------+
| **comment** | string  | The comment to append to the bug. If this is empty or all   |
+-------------+---------+-------------------------------------------------------------+
| is_private  | boolean | If set to true, the comment is private, otherwise it is     |
+-------------+---------+-------------------------------------------------------------+
| work_time   | double  | Adds this many hours to the "Hours Worked" on the bug. If   |
+-------------+---------+-------------------------------------------------------------+

**Response**

   {
     "id" : 789
   }

+------+------+-----------------------------------+
| name | type | description                       |
+======+======+===================================+
| id   | int  | ID of the newly-created comment.  |
+------+------+-----------------------------------+


Search Comment Tags
===================

Searches for tags which contain the provided substring.

**Request**

To search for comment tags:

   GET /rest/bug/comment/tags/(query)

Example:

   GET /rest/bug/comment/tags/spa

+-----------+--------+------------------------------------------------------+
| name      | type   | description                                          |
+===========+========+======================================================+
| **query** | string | Only tags containg this substring will be returned.  |
+-----------+--------+------------------------------------------------------+
| limit     | int    | If provided will return no more than "limit" tags.   |
+-----------+--------+------------------------------------------------------+

**Response**

   [
     "spam"
   ]

An array of matching tags.


Update Comment Tags
===================

Adds or removes tags from a comment.

**Request**

To update the tags comments attached to a comment:

   PUT /rest/bug/comment/(comment_id)/tags

Example:

   {
     "comment_id" : 75,
     "add" : ["spam", "bad"]
   }

+----------------+-------+--------------------------------------+
| name           | type  | description                          |
+================+=======+======================================+
| **comment_id** | int   | The ID of the comment to update.     |
+----------------+-------+--------------------------------------+
| add            | array | The tags to attach to the comment.   |
+----------------+-------+--------------------------------------+
| remove         | array | The tags to detach from the comment. |
+----------------+-------+--------------------------------------+

**Response**

   [
     "bad",
     "spam"
   ]

An array of strings containing the comment's updated tags.

======================================================================

This documentation undoubtedly has bugs; if you find some, please file
them here.
