summaryrefslogtreecommitdiffstats
path: root/docs/en/rst/api/core/v1/flagtype.rst
blob: 994ac27c84ab970bd3861e13f6d9cb25bf930896 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
Flag Types
==========

This part of the Bugzilla API allows you to get and create bug and attachment
flags.

.. _rest_flagtype_get:

Get Flag Type
-------------

Get information about valid flag types that can be set for bugs and attachments.

**Request**

To get information about all flag types for a product:

.. code-block:: text

   GET /rest/flag_type/(product)

To get information about flag_types for a product and component:

.. code-block:: text

   GET /rest/flag_type/(product)/(component)

.. code-block:: js

   {
     "bug": [
       {
         "is_multiplicable": false,
         "is_requesteeble": false,
         "values": [
           "X",
           "?",
           "+",
           "-"
         ],
         "id": 11,
         "type": "bug",
         "is_active": true,
         "description": "Blocks the next release",
         "name": "blocker"
       },
       {
         "is_requesteeble": false,
         "is_multiplicable": false,
         "is_active": true,
         "description": "Regression found?",
         "name": "regression",
         "id": 10,
         "type": "bug",
         "values": [
           "X",
           "?",
           "+",
           "-"
         ]
       },
     ],
     "attachment": [
       {
         "is_requesteeble": true,
         "is_multiplicable": true,
         "name": "review",
         "is_active": true,
         "description": "Review the patch for correctness and applicability to the problem.",
         "type": "attachment",
         "id": 1,
         "values": [
           "X",
           "?",
           "+",
           "-"
         ]
       },
       {
         "name": "approval",
         "description": "Approve the patch for check-in to the tree.",
         "is_active": true,
         "values": [
           "X",
           "?",
           "+",
           "-"
         ],
         "type": "attachment",
         "id": 3,
         "is_multiplicable": false,
         "is_requesteeble": false
       }
     ]
   }

You must pass a product name and an optional component name. If the product or
component names contains a ``/`` character, up will need to url encode it.

===========  ======  ============================================================
name         type    description
===========  ======  ============================================================
**product**  string  The name of a valid product.
component    string  An optional valid component name associated with the
                     product.
===========  ======  ============================================================

**Response**

An object containing two items, ``bug`` and ``attachment``. Each value is an
array of objects, containing the following items:

================  =======  ======================================================
name              type     description
================  =======  ======================================================
id                int      An integer ID uniquely identifying this flag type.
name              string   The name for the flag type.
type              string   The target of the flag type which is either ``bug``
                           or ``attachment``.
description       string   The description of the flag type.
values            array    String values that the user can set on the flag type.
is_requesteeble   boolean  Users can ask specific other users to set flags of
                           this type.
is_multiplicable  boolean  Multiple flags of this type can be set for the same
                           bug or attachment.
================  =======  ======================================================

Create Flag Type
----------------

Create a new flag type. You must be authenticated and be in the *editcomponents*
group to perform this action.

**Request**

.. code-block:: text

   POST /rest/flag_type

.. code-block:: js

   {
     "name" : "feedback",
     "description" : "This attachment needs feedback",
     "inclusions" : [ "WorldControl "],
     "target_type" : "attachment"
   }

Some params must be set, or an error will be thrown. The required params are
marked in **bold**.

===========================  =======  ===========================================
name                         type     description
===========================  =======  ===========================================
**name**                     string   The name of the new flag type.
**description**              string   A description for the flag type.
target_type                  string   The new flag is either for a ``bug`` or an
                                      ``attachment``.
inclusions                   array    An array of strings or an object containing
                                      product names, and optionally component
                                      names. If you provide a string, the flag
                                      type will be shown on all bugs in that
                                      product. If you provide an object, the key
                                      represents the product name, and the value
                                      is the components of the product to be
                                      included.
exclusions                   array    An array of strings or an object containing
                                      product names. This uses the same format as
                                      ``inclusions``. This will exclude the flag
                                      from all products and components specified.
sortkey                      int      A number between 1 and 32767 by which this
                                      type will be sorted when displayed to users
                                      in a list; ignore if you don't care what
                                      order the types appear in or if you want
                                      them to appear in alphabetical order.
is_active                    boolean  Flag of this type appear in the UI and can
                                      be set. Default is ``true``.
is_requestable               boolean  Users can ask for flags of this type to be
                                      set. Default is ``true``.
cc_list                      array    If the flag type is requestable, who should
                                      receive e-mail notification of requests.
                                      This is an array of e-mail addresses which\
                                      do not need to be Bugzilla logins.
is_specifically_requestable  boolean  Users can ask specific other users to
                                      set flags of this type as opposed to just
                                      asking the wind. Default is ``true``.
is_multiplicable             boolean  Multiple flags of this type can be set on
                                      the same bug. Default is ``true``.
grant_group                  string   The group allowed to grant/deny flags of
                                      this type (to allow all users to grant/deny
                                      these flags, select no group). Default is
                                      no group.
request_group                string   If flags of this type are requestable, the
                                      group allowed to request them (to allow all
                                      users to request these flags, select no
                                      group). Note that the request group alone
                                      has no effect if the grant group is not
                                      defined! Default is no group.
===========================  =======  ===========================================

An example for ``inclusions`` and/or ``exclusions``:

.. code-block:: js

   [
     "FooProduct"
   ]

   {
     "BarProduct" : [ "C1", "C3" ],
     "BazProduct" : [ "C7" ]
   }

This flag will be added to **all** components of ``FooProduct``, components C1
and C3 of ``BarProduct``, and C7 of ``BazProduct``.

**Response**

.. code-block:: js

   {
     "id": 13
   }

=======  ====  ==============================================
name     type  description
=======  ====  ==============================================
flag_id  int   ID of the new FlagType object is returned.
=======  ====  ==============================================

.. _rest_flagtype_update:

Update Flag Type
----------------

This allows you to update a flag type in Bugzilla. You must be authenticated
and be in the *editcomponents* group to perform this action.

**Request**

.. code-block:: text

   PUT /rest/flag_type/(id_or_name)

.. code-block:: js

   {
     "ids" : [13],
     "name" : "feedback-new",
     "is_requestable" : false
   }

You can edit a single flag type by passing the ID or name of the flag type
in the URL. To edit more than one flag type, you can specify addition IDs or
flag type names using the ``ids`` or ``names`` parameters respectively.

One of the below must be specified.

==============  =====  ==========================================================
name            type   description
==============  =====  ==========================================================
**id_or_name**  mixed  Integer flag type ID or name.
**ids**         array  Numeric IDs of the flag types that you wish to update.
**names**       array  Names of the flag types that you wish to update. If many
                       flag types have the same name, this will change **all**
                       of them.
==============  =====  ==========================================================

The following parameters specify the new values you want to set for the flag
types you are updating.

===========================  =======  ===========================================
name                         type     description
===========================  =======  ===========================================
name                         string   A short name identifying this type.
description                  string   A comprehensive description of this type.
inclusions                   array    An array of strings or an object containing
                                      product names, and optionally component
                                      names. If you provide a string, the flag
                                      type will be shown on all bugs in that
                                      product. If you provide an object, the key
                                      represents the product name, and the value
                                      is the components of the product to be
                                      included.
exclusions                   array    An array of strings or an object containing
                                      product names. This uses the same format as
                                      ``inclusions``. This will exclude the flag
                                      from all products and components specified.
sortkey                      int      A number between 1 and 32767 by which this
                                      type will be sorted when displayed to users
                                      in a list; ignore if you don't care what
                                      order the types appear in or if you want
                                      them to appear in alphabetical order.
is_active                    boolean  Flag of this type appear in the UI and can
                                      be set.
is_requestable               boolean  Users can ask for flags of this type to be
                                      set.
cc_list                      array    If the flag type is requestable, who should
                                      receive e-mail notification of requests.
                                      This is an array of e-mail addresses
                                      which do not need to be Bugzilla logins.
is_specifically_requestable  boolean  Users can ask specific other users to set
                                      flags of this type as opposed to just
                                      asking the wind.
is_multiplicable             boolean  Multiple flags of this type can be set on
                                      the same bug.
grant_group                  string   The group allowed to grant/deny flags of
                                      this type (to allow all users to grant/deny
                                      these flags, select no group).
request_group                string   If flags of this type are requestable, the
                                      group allowed to request them (to allow all
                                      users to request these flags, select no
                                      group). Note that the request group alone
                                      has no effect if the grant group is not
                                      defined!
===========================  =======  ===========================================

An example for ``inclusions`` and/or ``exclusions``:

.. code-block:: js

   [
     "FooProduct",
   ]

   {
     "BarProduct" : [ "C1", "C3" ],
     "BazProduct" : [ "C7" ]
   }

This flag will be added to **all** components of ``FooProduct``,
components C1 and C3 of ``BarProduct``, and C7 of ``BazProduct``.

**Response**

.. code-block:: js

   {
     "flagtypes": [
       {
         "name": "feedback-new",
         "changes": {
           "is_requestable": {
             "added": "0",
             "removed": "1"
           },
           "name": {
             "removed": "feedback",
             "added": "feedback-new"
           }
         },
         "id": 13
       }
     ]
   }

``flagtypes`` (array) Flag change objects containing the following items:

=======  ======  ================================================================
name     type    description
=======  ======  ================================================================
id       int     The ID of the flag type that was updated.
name     string  The name of the flag type that was updated.
changes  object  The changes that were actually done on this flag type.
                 The keys are the names of the fields that were changed, and the
                 values are an object with two items:

                 * added: (string) The value that this field was changed to.
                 * removed: (string) The value that was previously set in this
                   field.
=======  ======  ================================================================

Booleans changes will be represented with the strings '1' and '0'.