Bugzilla:BzAPI:Methods: Difference between revisions

(Add full deprecation notice)
 
(21 intermediate revisions by 6 users not shown)
Line 1: Line 1:
==Notes==
<div style="border: thin dotted #aaa; padding:5px;">
'''This specific REST API, generally referred to as "BzAPI", is DEPRECATED. For new projects, use the [[Bugzilla:REST_API|native REST API]] instead. The BMO team has implemented a [[Bugzilla:BzAPI:CompatLayer|compatibility layer]] to help existing apps transition off BzAPI onto the native REST API. Please migrate existing BzAPI-based apps to the new compatibility-layer endpoint as soon as possible, as BzAPI will be shut off at some point in the future. Direct any questions to the [[BMO]] team.


* All times are supplied as UTC, in the ISO 8601 extended format (e.g. "2009-06-21T12:34:56Z"). This should define the time unambiguously, and should be widely and easily parseable, at the expense of probably not being directly displayable without a little manipulation.
'''The native REST API is available in Bugzilla 5.0 and up, and on bugzilla.mozilla.org. Although BzAPI is deprecated, it can be used with older Bugzilla installations (versions prior to 5.0) to provide a REST API.'''
* Votes are not supported.
</div><br>


==Bugs==
==Bugs==
Line 10: Line 11:
'''Arguments'''
'''Arguments'''


[[Bugzilla:REST_API:Search|Search parameters]], exactly as powerful as query.cgi but using the field names from the Bug object rather than those from the web interface. (At the moment, it does also support the field names from the web interface, to make it easy to port URLs and other code across. But if supporting this becomes difficult, it might go away.)  
[[Bugzilla:BzAPI:Search|Search parameters]], exactly as powerful as query.cgi but using the field names from the Bug object rather than those from the web interface. (At the moment, it does also support the field names from the web interface, to make it easy to port URLs and other code across. But if supporting this becomes difficult, it might go away.)  


'''Response'''
'''Response'''


  { "bugs": [ <array of [[Bugzilla:REST_API:Objects#Bug|Bug]]> ] }
  { "bugs": [ <array of [[Bugzilla:BzAPI:Objects#Bug|Bug]]> ] }
 


'''Notes'''
'''Notes'''


* Examples: [https://api-dev.bugzilla.mozilla.org/latest/bug?product=Bugzilla&priority=P1&severity=blocker all P1 blockers in the Bugzilla product], [https://api-dev.bugzilla.mozilla.org/latest/bug?changed_after=1h all bugs changed in the last hour].  
* Examples: [https://api-dev.bugzilla.mozilla.org/latest/bug?product=Bugzilla&priority=P1&severity=blocker all P1 blockers in the Bugzilla product], [https://api-dev.bugzilla.mozilla.org/latest/bug?changed_after=1h all bugs changed in the last hour].  
* Only a subset of a bug's fields are returned on a search. These are those in bold on the [[Bugzilla:REST_API:Objects#Bug|list]]. As a rule of thumb, only single-valued fields are returned. As a workaround, you can get full bugs by specifying '''only''' bug IDs as the search criteria (see the documentation for /bug/<id> GET).
* By default, the fields returned are those in bold on the [[Bugzilla:BzAPI:Objects#Bug|Search page]]. You can use [[Bugzilla:BzAPI#Field_Control|include_fields]] to get more, and if you specify "include_fields=_all", you will get everything. (This may take longer.)
 
'''Errors'''


=== Count bugs (/count GET) ===  
=== Count bugs (/count GET) ===  
Line 27: Line 27:
'''Arguments'''
'''Arguments'''


[[Bugzilla:REST_API:Search|Search parameters]], as above, plus zero or more of '''x_axis_field''', '''y_axis_field''' and '''z_axis_field'''.
[[Bugzilla:BzAPI:Search|Search parameters]], as above (except quicksearch - sorry), plus zero or more of '''x_axis_field''', '''y_axis_field''' and '''z_axis_field'''.


'''Response'''
'''Response'''
Line 45: Line 45:
* Examples: [https://api-dev.bugzilla.mozilla.org/latest/count?product=Bugzilla&priority=P1&severity=blocker number of P1s in the Bugzilla product], [https://api-dev.bugzilla.mozilla.org/latest/count?product=Bugzilla&priority=P1&x_axis_field=severity the same, broken down by severity], [https://api-dev.bugzilla.mozilla.org/latest/count?product=Bugzilla&priority=P1&x_axis_field=severity&y_axis_field=component the same, broken down by severity and component].
* Examples: [https://api-dev.bugzilla.mozilla.org/latest/count?product=Bugzilla&priority=P1&severity=blocker number of P1s in the Bugzilla product], [https://api-dev.bugzilla.mozilla.org/latest/count?product=Bugzilla&priority=P1&x_axis_field=severity the same, broken down by severity], [https://api-dev.bugzilla.mozilla.org/latest/count?product=Bugzilla&priority=P1&x_axis_field=severity&y_axis_field=component the same, broken down by severity and component].
* If you specify a z_axis_field without an x or a y, or a y without an x, the results are undefined. So don't do that.
* If you specify a z_axis_field without an x or a y, or a y without an x, the results are undefined. So don't do that.
'''Errors'''


=== Create new bug (/bug POST) ===
=== Create new bug (/bug POST) ===
Line 52: Line 50:
'''Arguments'''
'''Arguments'''


[[Bugzilla:REST_API:Objects#Bug|Bug]], or part thereof, as POST body. The following fields are always compulsory: '''product''', '''component''', '''summary''' and '''version'''. The following fields may be compulsory depending on the configuration of your Bugzilla: '''description''', '''op_sys''', '''platform''', '''priority''' and '''severity'''.
[[Bugzilla:BzAPI:Objects#Bug|Bug]], or part thereof, as POST body. The following fields are always compulsory: '''product''', '''component''', '''summary''' and '''version'''. The following fields may be compulsory depending on the configuration of your Bugzilla: '''comments''' (single entry, as initial description), '''op_sys''', '''platform''', '''priority''' and '''severity'''.


'''Response'''
'''Response'''
Line 62: Line 60:
'''Notes'''
'''Notes'''


* The initial description is added using a [[Bugzilla:BzAPI:Objects#Comment|comment object]] attached to the bug as the first item in the "comments" array. All that is required is the "text" member.
* You can't add attachments with a new bug. Any attachment fields in the bug object will be ignored. Make a separate call.
* You can't add attachments with a new bug. Any attachment fields in the bug object will be ignored. Make a separate call.
'''Errors'''


=== Retrieve bug (/bug/<id> GET) ===
=== Retrieve bug (/bug/<id> GET) ===
Line 72: Line 69:
* Bug ID on the URL
* Bug ID on the URL
* Includes flags, CC list, related bugs and attachment metadata by default
* Includes flags, CC list, related bugs and attachment metadata by default
* Does not include attachment data, comments or history - so amount of data is bounded
* Does not include attachment data, comments or history - so amount of data is bounded (use [https://wiki.mozilla.org/index.php?title=Bugzilla:BzAPI#Field_Control field control] to get them)
* attachmentdata=1, comments=1 and history=1 do the obvious things (history requires 3.4)
* Multi-valued custom fields are not, in general, returned as arrays if there is 0 or 1 value. This is because I can't tell which custom fields are supposed to be multi-valued. As a hack, if your custom field name begins "cf_multi", it will get unconditionally array-ified. This limitation can only be lifted when the API is part of Bugzilla itself.
* Multi-valued custom fields are not, in general, returned as arrays if there is 0 or 1 value. This is because I can't tell which custom fields are supposed to be multi-valued. As a hack, if your custom field name begins "cf_multi", it will get unconditionally array-ified. This limitation can only be lifted when the API is part of Bugzilla itself.


'''Response'''
'''Response'''


[[Bugzilla:REST_API:Objects#Bug|Bug]].
[[Bugzilla:BzAPI:Objects#Bug|Bug]].


'''Notes'''
'''Notes'''


* Examples: [https://api-dev.bugzilla.mozilla.org/latest/bug/35 bug 35], [https://api-dev.bugzilla.mozilla.org/latest/bug/350001?comments=1&attachmentdata=1&history=1 bug 350001 with all comments, attachments and history].  
* Examples: [https://api-dev.bugzilla.mozilla.org/latest/bug/35 bug 35], [https://api-dev.bugzilla.mozilla.org/latest/bug/350001?include_fields=_default,comments,history,attachments.data bug 350001 with all comments, attachment data and history].  
* If you want to retrieve multiple [[Bugzilla:REST_API:Objects#Bug|Bug]]s at once, use the Search interface and specify only Bug IDs as your search criteria. You will be returned full [[Bugzilla:REST_API:Objects#Bug|Bug]] objects instead of the reduced number of fields normally presented on a Search. This is a shortcut to avoid people having to make 20 calls to get 20 full bug objects.
* If you want to retrieve multiple [[Bugzilla:BzAPI:Objects#Bug|Bug]]s at once, use the Search interface. That interface has a different (reduced) default set of fields, due to the Bugzilla call it uses on the back end. If it doesn't have the fields you want by default, specify <tt>include_fields=_all</tt>. This will behind the scenes fetch full [[Bugzilla:BzAPI:Objects#Bug|Bug]] objects for you. For best performance, specify only bug IDs as your search criteria.
 
'''Errors'''


=== Update bug (/bug/<id> PUT) ===
=== Update bug (/bug/<id> PUT) ===
Line 91: Line 85:
'''Arguments'''
'''Arguments'''


[[Bugzilla:REST_API:Objects#Bug|Bug]], or part thereof, as PUT body.
[[Bugzilla:BzAPI:Objects#Bug|Bug]], or part thereof, as PUT body.


'''Response'''
'''Response'''
Line 99: Line 93:
'''Notes'''
'''Notes'''


* '''Updating a bug fails if you don't supply a value for 'token'.''' This is a security token used by the web interface to prevent people's browsers being exploited to make unwanted changes. To get this token, retrieve the bug data first.
* If you pass a last_change_time, this call will check for editing conflicts. If you do not, it will unconditionally update the bug to the state you send. If there is a conflict, conflict resolution must be implemented by the client re-GETting the resource, resolving the conflict and re-PUTting the resolved version.
* If you pass a last_change_time, this call will check for editing conflicts. If you do not, it will unconditionally update the bug to the state you send. If there is a conflict, conflict resolution must be implemented by the client re-GETting the resource, resolving the conflict and re-PUTting the resolved version.
* You can only add one comment per call. Add a [[Bugzilla:REST_API:Objects#Comment|Comment]] object without an id to the comments array.
* You can only add one comment per call. Add a [[Bugzilla:BzAPI:Objects#Comment|Comment]] object without an id to the comments array.
* This call does not support the updating of attachment metadata. Make a separate call to update attachments.
* This call does not support the updating of attachment metadata. Make a separate call to update attachments.
* Set assigned_to or qa_contact to the special value <tt>null</tt> (in JSON) to reset them to the default for the current component.
* Set assigned_to or qa_contact to the special value <tt>null</tt> (in JSON) to reset them to the default for the current component.
Line 123: Line 118:
'''Response'''
'''Response'''


  { "comments": [ array of [[Bugzilla:REST_API:Objects#Comment|Comment]] ] }
  { "comments": [ array of [[Bugzilla:BzAPI:Objects#Comment|Comment]] ] }


In other words, a [[Bugzilla:REST_API:Objects#Bug|Bug]] with only the comment field.
In other words, a [[Bugzilla:BzAPI:Objects#Bug|Bug]] with only the comment field.


'''Notes'''
'''Notes'''
Line 131: Line 126:
* Example: [https://api-dev.bugzilla.mozilla.org/latest/bug/350001/comment bug 350001 comments].
* Example: [https://api-dev.bugzilla.mozilla.org/latest/bug/350001/comment bug 350001 comments].
* No comments (or none you can see) -> empty array.
* No comments (or none you can see) -> empty array.
'''Notes'''
'''Errors'''


=== Add new comment to bug (/bug/<id>/comment POST) ===
=== Add new comment to bug (/bug/<id>/comment POST) ===
Line 140: Line 131:
'''Arguments'''
'''Arguments'''


[[Bugzilla:REST_API:Objects#Comment|Comment]] as POST body.
[[Bugzilla:BzAPI:Objects#Comment|Comment]] as POST body.


'''Response'''
'''Response'''
Line 151: Line 142:


* Unconditional - no conflict checking
* Unconditional - no conflict checking
'''Errors'''


=== List history for bug (/bug/<id>/history GET) ===
=== List history for bug (/bug/<id>/history GET) ===
Line 163: Line 151:
'''Response'''
'''Response'''


  { "history": [ array of [[Bugzilla:REST_API:Objects#ChangeSet|ChangeSet]] ] }
  { "history": [ array of [[Bugzilla:BzAPI:Objects#ChangeSet|ChangeSet]] ] }


In other words, a [[Bugzilla:REST_API:Objects#Bug|Bug]] with only the history field.
In other words, a [[Bugzilla:BzAPI:Objects#Bug|Bug]] with only the history field.


'''Notes'''
'''Notes'''
Line 171: Line 159:
* Example: [https://api-dev.bugzilla.mozilla.org/latest/bug/350001/history bug 350001 history].
* Example: [https://api-dev.bugzilla.mozilla.org/latest/bug/350001/history bug 350001 history].
* This call requires Bugzilla 3.4 or above.
* This call requires Bugzilla 3.4 or above.
'''Errors'''


=== List flags for bug (/bug/<id>/flag GET) ===
=== List flags for bug (/bug/<id>/flag GET) ===
Line 182: Line 168:
'''Response'''
'''Response'''


  { "flags": [ array of [[Bugzilla:REST_API:Objects#Flag|Flag]] ] }
  { "flags": [ array of [[Bugzilla:BzAPI:Objects#Flag|Flag]] ] }


In other words, a [[Bugzilla:REST_API:Objects#Bug|Bug]] with only the flags field.
In other words, a [[Bugzilla:BzAPI:Objects#Bug|Bug]] with only the flags field.


'''Notes'''
'''Notes'''


* Example: [https://api-dev.bugzilla.mozilla.org/latest/bug/500004/flag bug 500004 flags].  
* Example: [https://api-dev.bugzilla.mozilla.org/latest/bug/500004/flag bug 500004 flags].  
'''Errors'''


==Attachments==
==Attachments==
Line 199: Line 183:


* Bug ID on the URL.
* Bug ID on the URL.
* attachmentdata=1 does the obvious thing.
* attachmentdata=1 does the obvious thing (it's a shorthand for "include_fields=_default,data,encoding").


'''Response'''
'''Response'''


  { "attachments": [ array of [[Bugzilla:REST_API:Objects#Attachment|Attachment]] ] }
  { "attachments": [ array of [[Bugzilla:BzAPI:Objects#Attachment|Attachment]] ] }


In other words, a [[Bugzilla:REST_API:Objects#Bug|Bug]] with only the attachment field.
In other words, a [[Bugzilla:BzAPI:Objects#Bug|Bug]] with only the attachments field.


'''Notes'''
'''Notes'''
Line 211: Line 195:
* Examples: [https://api-dev.bugzilla.mozilla.org/latest/bug/500004/attachment bug 500004 attachments], [https://api-dev.bugzilla.mozilla.org/latest/bug/350001/attachment?attachmentdata=1 bug 350001 attachments with data].
* Examples: [https://api-dev.bugzilla.mozilla.org/latest/bug/500004/attachment bug 500004 attachments], [https://api-dev.bugzilla.mozilla.org/latest/bug/350001/attachment?attachmentdata=1 bug 350001 attachments with data].
* No attachments -> empty array.
* No attachments -> empty array.
'''Errors'''


=== Create new attachment (/bug/<id>/attachment POST) ===
=== Create new attachment (/bug/<id>/attachment POST) ===
Line 218: Line 200:
'''Arguments'''
'''Arguments'''


[[Bugzilla:REST_API:Objects#Attachment|Attachment]] as POST body.
[[Bugzilla:BzAPI:Objects#Attachment|Attachment]] as POST body.


'''Response'''
'''Response'''
Line 230: Line 212:
* You can't set is_obsolete on a new attachment submission
* You can't set is_obsolete on a new attachment submission
* You can't set the same (multi-settable) flag twice on a single attachment submission
* You can't set the same (multi-settable) flag twice on a single attachment submission
'''Errors'''


=== Retrieve attachment (/attachment/<id> GET) ===
=== Retrieve attachment (/attachment/<id> GET) ===
Line 238: Line 218:


* Attachment ID on the URL.
* Attachment ID on the URL.
* attachmentdata=1 does the obvious thing.
* attachmentdata=1 does the obvious thing (it's a shorthand for "include_fields=_default,data,encoding").


'''Response'''
'''Response'''


[[Bugzilla:REST_API:Objects#Attachment|Attachment]].
[[Bugzilla:BzAPI:Objects#Attachment|Attachment]].


'''Notes'''
'''Notes'''


* Examples: [https://api-dev.bugzilla.mozilla.org/latest/attachment/235466?content-type=text/html attachment 235466], [https://api-dev.bugzilla.mozilla.org/latest/attachment/386129?attachmentdata=1 attachment 386129 with attachment data].
* Examples: [https://api-dev.bugzilla.mozilla.org/latest/attachment/235466?content-type=text/html attachment 235466], [https://api-dev.bugzilla.mozilla.org/latest/attachment/386129?attachmentdata=1 attachment 386129 with attachment data].
'''Errors'''


=== Update attachment metadata (/attachment/<id> PUT) ===
=== Update attachment metadata (/attachment/<id> PUT) ===
Line 254: Line 232:
'''Arguments'''
'''Arguments'''


[[Bugzilla:REST_API:Objects#Attachment|Attachment]] as PUT body.
[[Bugzilla:BzAPI:Objects#Attachment|Attachment]] as PUT body.


'''Response'''
'''Response'''
Line 262: Line 240:
'''Notes'''
'''Notes'''


* '''Updating an attachment fails if you don't supply a value for 'token'.''' This is a security token used by the web interface to prevent people's browsers being exploited to make unwanted changes. To get this token, retrieve the attachment data first.
* If you pass a last_change_time, this call will check for editing conflicts. If you do not, it will unconditionally update the bug to the state you send. If there is a conflict, conflict resolution must be implemented by the client re-GETting the resource, resolving the conflict and re-PUTting the resolved version.
* If you pass a last_change_time, this call will check for editing conflicts. If you do not, it will unconditionally update the bug to the state you send. If there is a conflict, conflict resolution must be implemented by the client re-GETting the resource, resolving the conflict and re-PUTting the resolved version.
* You can't set the same (multi-settable) flag twice on a single attachment submission
* You can't set the same (multi-settable) flag twice on a single attachment submission
* To make this call check for conflicts, submit the last_change_time you received when getting the attachment data. To make unconditional updates (be careful!) simply do not supply a last_change_time.  
* To make this call check for conflicts, submit the last_change_time you received when getting the attachment data. To make unconditional updates (be careful!) simply do not supply a last_change_time.  


'''Errors'''
==Users==
 
==Users ==


=== Search for users (/user GET) ===
=== Search for users (/user GET) ===
Line 278: Line 255:
'''Response'''
'''Response'''


  { users: [ array of [[Bugzilla:REST_API:Objects#User|User]] ] }
  { users: [ array of [[Bugzilla:BzAPI:Objects#User|User]] ] }


'''Notes'''
'''Notes'''
Line 285: Line 262:
* No matches -> empty array.
* No matches -> empty array.
* This call requires Bugzilla 3.4 or above.
* This call requires Bugzilla 3.4 or above.
 
* In Bugzilla 4.0 and above, only enabled (non-disabled) users will be returned. A later release of BzAPI will have a way of asking for results which include disabled users.
'''Errors'''


=== Retrieve user (/user/<id> GET) ===
=== Retrieve user (/user/<id> GET) ===
Line 296: Line 272:
'''Response'''
'''Response'''


[[Bugzilla:REST_API:Objects#User|User]].  
[[Bugzilla:BzAPI:Objects#User|User]].  


'''Notes'''
'''Notes'''
Line 302: Line 278:
* Example: [https://api-dev.bugzilla.mozilla.org/latest/user/gerv@mozilla.org user 'gerv@mozilla.org'].
* Example: [https://api-dev.bugzilla.mozilla.org/latest/user/gerv@mozilla.org user 'gerv@mozilla.org'].
* This call requires Bugzilla 3.4 or above.
* This call requires Bugzilla 3.4 or above.
'''Errors'''


==Other==
==Other==
Line 311: Line 285:
'''Arguments'''
'''Arguments'''


* None
* The flags=0 parameter removes flag-related information from the config; because flags can be enabled or disabled per-component, there is a lot of flag-related info and so this cuts down the size significantly. However, you will not be able to add new flags to bugs or attachments without this info.
* The cached_ok=1 parameter allows BzAPI to return cached data. BzAPI caches the output every time someone calls /configuration (or the noflags variant) and will pass the data back to you without contacting Bugzilla if you say that it's OK to send cached data. If the data was returned from the cache (which is not guaranteed), the JSON hash will have a "last_updated" value which is a unix time_t defining when the data was refreshed. It's your responsibility to see if that's recent enough and, if not, call the call again without "cached_ok=1".


'''Response'''
'''Response'''


[[Bugzilla:REST_API:Objects:Configuration|Configuration]]
[[Bugzilla:BzAPI:Objects:Configuration|Configuration]]


'''Notes'''
'''Notes'''


* Example: [https://api-dev.bugzilla.mozilla.org/latest/configuration b.m.o. configuration].
* Example: [https://api-dev.bugzilla.mozilla.org/latest/configuration b.m.o. configuration].
* flags=0 parameter removes flag-related information from the config; because flags can be enabled or disabled per-component, there is a lot of flag-related info and so this cuts down the size significantly. However, you will not be able to add new flags to bugs or attachments without this info.
'''Errors'''

Latest revision as of 02:07, 21 September 2016

This specific REST API, generally referred to as "BzAPI", is DEPRECATED. For new projects, use the native REST API instead. The BMO team has implemented a compatibility layer to help existing apps transition off BzAPI onto the native REST API. Please migrate existing BzAPI-based apps to the new compatibility-layer endpoint as soon as possible, as BzAPI will be shut off at some point in the future. Direct any questions to the BMO team.

The native REST API is available in Bugzilla 5.0 and up, and on bugzilla.mozilla.org. Although BzAPI is deprecated, it can be used with older Bugzilla installations (versions prior to 5.0) to provide a REST API.


Bugs

Search for bugs (/bug GET)

Arguments

Search parameters, exactly as powerful as query.cgi but using the field names from the Bug object rather than those from the web interface. (At the moment, it does also support the field names from the web interface, to make it easy to port URLs and other code across. But if supporting this becomes difficult, it might go away.)

Response

{ "bugs": [ <array of Bug> ] }


Notes

Count bugs (/count GET)

Arguments

Search parameters, as above (except quicksearch - sorry), plus zero or more of x_axis_field, y_axis_field and z_axis_field.

Response

Counts of bugs, as a scalar, 1D, 2D or 3D array depending on how many axis_field parameters you specified.

{ "data": 136 }

{ "data": [136, 121, 0, 33] }

{ "data": [ [136, 121, 0, 33], [7, 14, 21, 28] ] }

{ "data": [ [ [136, 121], [0, 33] ], [ [7, 14], [21, 28] ] ] }

Notes

Create new bug (/bug POST)

Arguments

Bug, or part thereof, as POST body. The following fields are always compulsory: product, component, summary and version. The following fields may be compulsory depending on the configuration of your Bugzilla: comments (single entry, as initial description), op_sys, platform, priority and severity.

Response

201 Created status code, Location header pointing to new bug object.

{ "ref": "<same-as-location-header>" }

Notes

  • The initial description is added using a comment object attached to the bug as the first item in the "comments" array. All that is required is the "text" member.
  • You can't add attachments with a new bug. Any attachment fields in the bug object will be ignored. Make a separate call.

Retrieve bug (/bug/<id> GET)

Arguments

  • Bug ID on the URL
  • Includes flags, CC list, related bugs and attachment metadata by default
  • Does not include attachment data, comments or history - so amount of data is bounded (use field control to get them)
  • Multi-valued custom fields are not, in general, returned as arrays if there is 0 or 1 value. This is because I can't tell which custom fields are supposed to be multi-valued. As a hack, if your custom field name begins "cf_multi", it will get unconditionally array-ified. This limitation can only be lifted when the API is part of Bugzilla itself.

Response

Bug.

Notes

  • Examples: bug 35, bug 350001 with all comments, attachment data and history.
  • If you want to retrieve multiple Bugs at once, use the Search interface. That interface has a different (reduced) default set of fields, due to the Bugzilla call it uses on the back end. If it doesn't have the fields you want by default, specify include_fields=_all. This will behind the scenes fetch full Bug objects for you. For best performance, specify only bug IDs as your search criteria.

Update bug (/bug/<id> PUT)

Arguments

Bug, or part thereof, as PUT body.

Response

{ "ok": 1 }

Notes

  • Updating a bug fails if you don't supply a value for 'token'. This is a security token used by the web interface to prevent people's browsers being exploited to make unwanted changes. To get this token, retrieve the bug data first.
  • If you pass a last_change_time, this call will check for editing conflicts. If you do not, it will unconditionally update the bug to the state you send. If there is a conflict, conflict resolution must be implemented by the client re-GETting the resource, resolving the conflict and re-PUTting the resolved version.
  • You can only add one comment per call. Add a Comment object without an id to the comments array.
  • This call does not support the updating of attachment metadata. Make a separate call to update attachments.
  • Set assigned_to or qa_contact to the special value null (in JSON) to reset them to the default for the current component.
  • To make this call check for conflicts, submit the last_change_time you received when getting the bug data. To make unconditional updates (be careful!) simply do not supply a last_change_time.
  • You can update most fields singly, but some fields are coupled, and must be provided as a set (even if one has not changed), as follows:
    • 'status' and 'resolution'
    • 'blocks' and 'dependson'
    • 'component' and 'product'
    • 'version' and 'target_milestone' require 'product'

Errors

  • This call will return a "Mid-air collision" error if you submit a last_change_time earlier than the one Bugzilla has on record.

List comments for bug (/bug/<id>/comment GET)

Arguments

  • Bug ID on the URL
  • "new_since" DateTime parameter (YYYYMMDDTHHMMSS format only) returns only ones since date given. (3.4 or above only)

Response

{ "comments": [ array of Comment ] }

In other words, a Bug with only the comment field.

Notes

Add new comment to bug (/bug/<id>/comment POST)

Arguments

Comment as POST body.

Response

201 Created status code, Location header pointing to bug/<id>/comment (as individual comments don't have their own location).

{ "ref": "<same-as-location-header>" }

Notes

  • Unconditional - no conflict checking

List history for bug (/bug/<id>/history GET)

Arguments

  • Bug ID on the URL.

Response

{ "history": [ array of ChangeSet ] }

In other words, a Bug with only the history field.

Notes

List flags for bug (/bug/<id>/flag GET)

Arguments

  • Bug ID on the URL.

Response

{ "flags": [ array of Flag ] }

In other words, a Bug with only the flags field.

Notes

Attachments

List attachments for bug (/bug/<id>/attachment GET)

Arguments

  • Bug ID on the URL.
  • attachmentdata=1 does the obvious thing (it's a shorthand for "include_fields=_default,data,encoding").

Response

{ "attachments": [ array of Attachment ] }

In other words, a Bug with only the attachments field.

Notes

Create new attachment (/bug/<id>/attachment POST)

Arguments

Attachment as POST body.

Response

201 Created status code, Location header pointing to new object.

{ "ref": "<same-as-location-header>" }

Notes

  • You can't set is_obsolete on a new attachment submission
  • You can't set the same (multi-settable) flag twice on a single attachment submission

Retrieve attachment (/attachment/<id> GET)

Arguments

  • Attachment ID on the URL.
  • attachmentdata=1 does the obvious thing (it's a shorthand for "include_fields=_default,data,encoding").

Response

Attachment.

Notes

Update attachment metadata (/attachment/<id> PUT)

Arguments

Attachment as PUT body.

Response

{ "ok": 1 }

Notes

  • Updating an attachment fails if you don't supply a value for 'token'. This is a security token used by the web interface to prevent people's browsers being exploited to make unwanted changes. To get this token, retrieve the attachment data first.
  • If you pass a last_change_time, this call will check for editing conflicts. If you do not, it will unconditionally update the bug to the state you send. If there is a conflict, conflict resolution must be implemented by the client re-GETting the resource, resolving the conflict and re-PUTting the resolved version.
  • You can't set the same (multi-settable) flag twice on a single attachment submission
  • To make this call check for conflicts, submit the last_change_time you received when getting the attachment data. To make unconditional updates (be careful!) simply do not supply a last_change_time.

Users

Search for users (/user GET)

Arguments

  • "match" parameter with string to match against either name or real_name.

Response

{ users: [ array of User ] }

Notes

  • Examples: not possible as this API requires the user to be logged in.
  • No matches -> empty array.
  • This call requires Bugzilla 3.4 or above.
  • In Bugzilla 4.0 and above, only enabled (non-disabled) users will be returned. A later release of BzAPI will have a way of asking for results which include disabled users.

Retrieve user (/user/<id> GET)

Arguments

User ID on the URL. Can be numeric ID or email address.

Response

User.

Notes

Other

Configuration (/configuration GET)

Arguments

  • The flags=0 parameter removes flag-related information from the config; because flags can be enabled or disabled per-component, there is a lot of flag-related info and so this cuts down the size significantly. However, you will not be able to add new flags to bugs or attachments without this info.
  • The cached_ok=1 parameter allows BzAPI to return cached data. BzAPI caches the output every time someone calls /configuration (or the noflags variant) and will pass the data back to you without contacting Bugzilla if you say that it's OK to send cached data. If the data was returned from the cache (which is not guaranteed), the JSON hash will have a "last_updated" value which is a unix time_t defining when the data was refreshed. It's your responsibility to see if that's recent enough and, if not, call the call again without "cached_ok=1".

Response

Configuration

Notes