
Bug Fields
**********

The Bugzilla API for getting details about bug fields.


Fields
======

Get information about valid bug fields, including the lists of legal
values for each field.

**Request**

To get information about all fields:

   GET /rest/field/bug

To get information related to a single field:

   GET /rest/field/bug/(id_or_name)

+------------+-------+------------------------------------------------------------+
| name       | type  | description                                                |
+============+=======+============================================================+
| id_or_name | mixed | An integer field ID or string representing the field name. |
+------------+-------+------------------------------------------------------------+

**Response**

   {
     "fields": [
       {
         "display_name": "Priority",
         "name": "priority",
         "type": 2,
         "is_mandatory": false,
         "value_field": null,
         "values": [
           {
             "sortkey": 100,
             "sort_key": 100,
             "visibility_values": [],
             "name": "P1"
           },
           {
             "sort_key": 200,
             "name": "P2",
             "visibility_values": [],
             "sortkey": 200
           },
           {
             "sort_key": 300,
             "visibility_values": [],
             "name": "P3",
             "sortkey": 300
           },
           {
             "sort_key": 400,
             "name": "P4",
             "visibility_values": [],
             "sortkey": 400
           },
           {
             "name": "P5",
             "visibility_values": [],
             "sort_key": 500,
             "sortkey": 500
           }
         ],
         "visibility_values": [],
         "visibility_field": null,
         "is_on_bug_entry": false,
         "is_custom": false,
         "id": 13
       }
     ]
   }

"field" (array) Field objects each containing the following items:

+-------------------+---------+-------------------------------------------------------+
| name              | type    | description                                           |
+===================+=========+=======================================================+
| id                | int     | An integer ID uniquely identifying this field in this |
+-------------------+---------+-------------------------------------------------------+
| type              | int     | The number of the fieldtype. The following values are |
+-------------------+---------+-------------------------------------------------------+
| is_custom         | boolean | "true" when this is a custom field, "false"           |
+-------------------+---------+-------------------------------------------------------+
| name              | string  | The internal name of this field. This is a unique     |
+-------------------+---------+-------------------------------------------------------+
| display_name      | string  | The name of the field, as it is shown in the user     |
+-------------------+---------+-------------------------------------------------------+
| is_mandatory      | boolean | "true" if the field must have a value when filing new |
+-------------------+---------+-------------------------------------------------------+
| is_on_bug_entry   | boolean | For custom fields, this is "true" if the field is     |
+-------------------+---------+-------------------------------------------------------+
| visibility_field  | string  | The name of a field that controls the visibility of   |
+-------------------+---------+-------------------------------------------------------+
| visibility_values | array   | This field is only shown when "visibility_field"      |
+-------------------+---------+-------------------------------------------------------+
| value_field       | string  | The name of the field that controls whether or not    |
+-------------------+---------+-------------------------------------------------------+
| values            | array   | Objects representing the legal values for select-type |
+-------------------+---------+-------------------------------------------------------+

Value object:

+-------------------+---------+-------------------------------------------------------+
| name              | type    | description                                           |
+===================+=========+=======================================================+
| name              | string  | The actual value--this is what you would specify for  |
+-------------------+---------+-------------------------------------------------------+
| sort_key          | int     | Values, when displayed in a list, are sorted first by |
+-------------------+---------+-------------------------------------------------------+
| visibility_values | array   | If "value_field" is defined for this field, then this |
+-------------------+---------+-------------------------------------------------------+
| is_active         | boolean | This value is defined only for certain product-       |
+-------------------+---------+-------------------------------------------------------+
| description       | string  | The description of the value. This item is only       |
+-------------------+---------+-------------------------------------------------------+
| is_open           | boolean | For "bug_status" values, determines whether this      |
+-------------------+---------+-------------------------------------------------------+
| can_change_to     | array   | For "bug_status" values, this is an array of objects  |
+-------------------+---------+-------------------------------------------------------+


Legal Values
============

**DEPRECATED** Use ''Fields'' instead.

Tells you what values are allowed for a particular field.

**Request**

To get information on the values for a field based on field name:

   GET /rest/field/bug/(field)/values

To get information based on field name and a specific product:

   GET /rest/field/bug/(field)/(product_id)/values

+------------+--------+---------------------------------------------------------------+
| name       | type   | description                                                   |
+============+========+===============================================================+
| field      | string | The name of the field you want information about. This should |
+------------+--------+---------------------------------------------------------------+
| product_id | int    | If you're picking a product-specific field, you have to       |
+------------+--------+---------------------------------------------------------------+

**Resppnse**

   {
     "values": [
       "P1",
       "P2",
       "P3",
       "P4",
       "P5"
     ]
   }

+------------+--------+---------------------------------------------------------------+
| name       | type   | description                                                   |
+============+========+===============================================================+
| values     | array  | The legal values for this field. The values will be sorted as |
+------------+--------+---------------------------------------------------------------+

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

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