Bugzilla::Webservice::Bug - The API for creating, changing, and getting the details of bugs.
This part of the Bugzilla API allows you to file a new bug in Bugzilla, or get information about bugs that have already been filed.
See Bugzilla::WebService for a description of how parameters are passed, and what STABLE, UNSTABLE, and EXPERIMENTAL mean.
fields
UNSTABLE
Get information about valid bug fields, including the lists of legal values for each field.
You can pass either field ids or field names.
Note: If neither ids
nor names
is specified,
then all non-obsolete fields will be returned.
In addition to the parameters below, this method also accepts the standard include_fields and exclude_fields arguments.
ids
(array) - An array of integer field ids.names
(array) - An array of strings representing field names.A hash containing a single element,
fields
.
This is an array of hashes,
containing the following keys:
id
int
An integer id uniquely identifying this field in this installation only.
type
int
The number of the fieldtype.
The following values are defined:
0
Unknown1
Free Text2
Drop Down3
Multiple-Selection Box4
Large Text Box5
Date/Time6
Bug Id7
Bug URLs ("See Also")is_custom
boolean
True when this is a custom field,
false otherwise.
name
string
The internal name of this field.
This is a unique identifier for this field.
If this is not a custom field,
then this name will be the same across all Bugzilla installations.
display_name
string
The name of the field,
as it is shown in the user interface.
is_on_bug_entry
boolean
For custom fields,
this is true if the field is shown when you enter a new bug.
For standard fields,
this is currently always false,
even if the field shows up when entering a bug.
(To know whether or not a standard field is valid on bug entry,
see "create".)
visibility_field
string
The name of a field that controls the visibility of this field in the user interface.
This field only appears in the user interface when the named field is equal to one of the values in visibility_values
.
Can be null.
visibility_values
array
of string
s This field is only shown when visibility_field
matches one of these values.
When visibility_field
is null,
then this is an empty array.
value_field
string
The name of the field that controls whether or not particular values of the field are shown in the user interface.
Can be null.
values
This is an array of hashes,
representing the legal values for select-type (drop-down and multiple-selection) fields.
This is also populated for the component
,
version
,
and target_milestone
fields,
but not for the product
field (you must use Product.get_accessible_products for that.
For fields that aren't select-type fields, this will simply be an empty array.
Each hash has the following keys:
name
string
The actual value--this is what you would specify for this field in "create",
etc.
sortkey
int
Values,
when displayed in a list,
are sorted first by this integer and then secondly by their name.
visibility_values
If value_field
is defined for this field,
then this value is only shown if the value_field
is set to one of the values listed in this array.
Note that for per-product fields,
value_field
is set to 'product'
and visibility_values
will reflect which product(s) this value appears in.
is_open
boolean
For bug_status
values,
determines whether this status specifies that the bug is "open" (true) or "closed" (false).
This item is only included for the bug_status
field.
can_change_to
For bug_status
values,
this is an array of hashes that determines which statuses you can transition to from this status.
(This item is only included for the bug_status
field.)
Each hash contains the following items:
name
the name of the new status
comment_required
this boolean
True if a comment is required when you change a bug into this status using this transition.
You specified an invalid field name or id.
legal_values
DEPRECATED - Use "fields" instead.
Tells you what values are allowed for a particular field.
field
- The name of the field you want information about.
This should be the same as the name you would use in "create",
below.product_id
- If you're picking a product-specific field,
you have to specify the id of the product you want the values for.values
- An array of strings: the legal values for this field.
The values will be sorted as they normally would be in Bugzilla.
You were required to specify a product, and either you didn't, or you specified an invalid product (or a product that you can't access).
You specified a field that doesn't exist or isn't a drop-down field.
attachments
EXPERIMENTAL
It allows you to get data about attachments, given a list of bugs and/or attachment ids.
Note: Private attachments will only be returned if you are in the insidergroup or if you are the submitter of the attachment.
Note: At least one of ids
or attachment_ids
is required.
ids
See the description of the ids
parameter in the "get" method.
attachment_ids
array
An array of integer attachment ids.
A hash containing two elements: bugs
and attachments
.
The return value looks like this:
{ bugs => { 1345 => [ { (attachment) }, { (attachment) } ], 9874 => [ { (attachment) }, { (attachment) } ], }, attachments => { 234 => { (attachment) }, 123 => { (attachment) }, } }
The attachments of any bugs that you specified in the ids
argument in input are returned in bugs
on output. bugs
is a hash that has integer bug IDs for keys and the values are arrayrefs that contain hashes as attachments. (Fields for attachments are described below.)
For any attachments that you specified directly in attachment_ids
, they are returned in attachments
on output. This is a hash where the attachment ids point directly to hashes describing the individual attachment.
The fields for each attachment (where it says (attachment)
in the diagram above) are:
creation_time
dateTime
The time the attachment was created.
last_change_time
dateTime
The last time the attachment was modified.
id
int
The numeric id of the attachment.
bug_id
int
The numeric id of the bug that the attachment is attached to.
file_name
string
The file name of the attachment.
description
string
The description for the attachment.
content_type
string
The MIME type of the attachment.
is_private
boolean
True if the attachment is private (only visible to a certain group called the "insidergroup"), False otherwise.
is_obsolete
boolean
True if the attachment is obsolete, False otherwise.
is_url
boolean
True if the attachment is a URL instead of actual data, False otherwise. Note that such attachments only happen when the Bugzilla installation has at some point had the allow_attach_url
parameter enabled.
is_patch
boolean
True if the attachment is a patch, False otherwise.
attacher
string
The login name of the user that created the attachment.
This method can throw all the same errors as "get". In addition, it can also throw the following error:
You specified the id of a private attachment in the attachment_ids
argument, and you are not in the "insider group" that can see private attachments.
comments
STABLE
This allows you to get data about comments, given a list of bugs and/or comment ids.
Note: At least one of ids
or comment_ids
is required.
In addition to the parameters below, this method also accepts the standard include_fields and exclude_fields arguments.
ids
array
An array that can contain both bug IDs and bug aliases. All of the comments (that are visible to you) will be returned for the specified bugs.
comment_ids
array
An array of integer comment_ids. These comments will be returned individually, separate from any other comments in their respective bugs.
new_since
dateTime
If specified, the method will only return comments newer than this time. This only affects comments returned from the ids
argument. You will always be returned all comments you request in the comment_ids
argument, even if they are older than this date.
Two items are returned:
bugs
This is used for bugs specified in ids
. This is a hash, where the keys are the numeric ids of the bugs, and the value is a hash with a single key, comments
, which is an array of comments. (The format of comments is described below.)
Note that 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 hash 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 hash that contains the following keys:
int
The globally unique ID for the comment.
int
The ID of the bug that this comment is on.
int
If the comment was made on an attachment, this will be the ID of that attachment. Otherwise it will be null.
string
The actual text of the comment.
string
The login name of the comment's author.
dateTime
The time (in Bugzilla's timezone) that the comment was added.
boolean
True if this comment is private (only visible to a certain group called the "insidergroup"), False otherwise.
This method can throw all the same errors as "get". In addition, it can also throw the following errors:
You specified the id of a private comment in the comment_ids
argument, and you are not in the "insider group" that can see private comments.
You specified an id in the comment_ids
argument that is invalid--either you specified something that wasn't a number, or there is no comment with that id.
attachment_id
was added to the return value in Bugzilla 3.6.get
STABLE
Gets information about particular bugs in the database.
Note: Can also be called as "get_bugs" for compatibilty with Bugzilla 3.0 API.
ids
An array of numbers and strings.
If an element in the array is entirely numeric, it represents a bug_id from the Bugzilla database to fetch. If it contains any non-numeric characters, it is considered to be a bug alias instead, and the bug with that alias will be loaded.
Note that it's possible for aliases to be disabled in Bugzilla, in which case you will be told that you have specified an invalid bug_id if you try to specify an alias. (It will be error 100.)
permissive
EXPERIMENTALboolean
Normally, if you request any inaccessible or invalid bug ids, Bug.get will throw an error. If this parameter is True, instead of throwing an error we return an array of hashes with a id
, faultString
and faultCode
for each bug that fails, and return normal information for the other bugs that were accessible.
Two items are returned:
bugs
An array of hashes that contains information about the bugs with the valid ids. Each hash contains the following items:
string
The alias of this bug. If there is no alias or aliases are disabled in this Bugzilla, this will be an empty string.
string
The login name of the user to whom the bug is assigned.
string
The name of the current component of this bug.
dateTime
When the bug was created.
int
The bug ID of the bug that this bug is a duplicate of. If this bug isn't a duplicate of any bug, this will be an empty int.
int
The numeric bug_id of this bug.
A hash. The internals of a Bugzilla::Bug object. This is extremely unstable, and you should only rely on this if you absolutely have to. The structure of the hash may even change between point releases of Bugzilla.
This will be disappearing in a future version of Bugzilla.
boolean
Returns true (1) if this bug is open, false (0) if it is closed.
dateTime
When the bug was last changed.
string
The priority of the bug.
string
The name of the product this bug is in.
string
The current resolution of the bug, or an empty string if the bug is open.
string
The current severity of the bug.
string
The current status of the bug.
string
The summary of this bug.
faults
EXPERIMENTALAn array of hashes that contains invalid bug ids with error messages returned for them. Each hash contains the following items:
int
The numeric bug_id of this bug.
c<string> This will only be returned for invalid bugs if the permissive
argument was set when calling Bug.get, and it is an error indicating that the bug id was invalid.
c<int> This will only be returned for invalid bugs if the permissive
argument was set when calling Bug.get, and it is the error code for the invalid bug error.
If you specified an alias and either: (a) the Bugzilla you're querying doesn't support aliases or (b) there is no bug with that alias.
The bug_id you specified doesn't exist in the database.
You do not have access to the bug_id you specified.
permissive
argument added to this method's params in Bugzilla 3.4.bugs
faults
history
EXPERIMENTAL
Gets the history of changes for particular bugs in the database.
ids
An array of numbers and strings.
If an element in the array is entirely numeric, it represents a bug_id from the Bugzilla database to fetch. If it contains any non-numeric characters, it is considered to be a bug alias instead, and the data bug with that alias will be loaded.
Note that it's possible for aliases to be disabled in Bugzilla, in which case you will be told that you have specified an invalid bug_id if you try to specify an alias. (It will be error 100.)
A hash containing a single element, bugs
. This is an array of hashes, containing the following keys:
int
The numeric id of the bug.
string
The alias of this bug. If there is no alias or aliases are disabled in this Bugzilla, this will be undef.
array
An array of hashes, each hash having the following keys:
dateTime
The date the bug activity/change happened.
string
The login name of the user who performed the bug change.
array
An array of hashes which contain all the changes that happened to the bug at this time (as specified by when
). Each hash contains the following items:
string
The name of the bug field that has changed.
string
The previous value of the bug field which has been deleted by the change.
string
The new value of the bug field which has been added by the change.
int
The id of the attachment that was changed. This only appears if the change was to an attachment, otherwise attachment_id
will not be present in this hash.
The same as "get".
search
UNSTABLE
Allows you to search for bugs based on particular criteria.
Unless otherwise specified in the description of a parameter, bugs are returned if they match exactly the criteria you specify in these parameters. That is, we don't match against substrings--if a bug is in the "Widgets" product and you ask for bugs in the "Widg" product, you won't get anything.
Criteria are joined in a logical AND. That is, you will be returned bugs that match all of the criteria, not bugs that match any of the criteria.
Each parameter can be either the type it says, or an array of the types it says. If you pass an array, it means "Give me bugs with any of these values." For example, if you wanted bugs that were in either the "Foo" or "Bar" products, you'd pass:
product => ['Foo', 'Bar']
Some Bugzillas may treat your arguments case-sensitively, depending on what database system they are using. Most commonly, though, Bugzilla is not case-sensitive with the arguments passed (because MySQL is the most-common database to use with Bugzilla, and MySQL is not case sensitive).
alias
string
The unique alias for this bug. Note that you can search by alias even if the alias field is disabled in this Bugzilla, but it's likely that there won't be any aliases set on bugs, in that case.
assigned_to
string
The login name of a user that a bug is assigned to.
component
string
The name of the Component that the bug is in. Note that if there are multiple Components with the same name, and you search for that name, bugs in all those Components will be returned. If you don't want this, be sure to also specify the product
argument.
creation_time
dateTime
Searches for bugs that were created at this time or later. May not be an array.
id
int
The numeric id of the bug.
last_change_time
dateTime
Searches for bugs that were modified at this time or later. May not be an array.
limit
int
Limit the number of results returned to int
records.
offset
int
Used in conjunction with the limit
argument, offset
defines the starting position for the search. For example, given a search that would return 100 bugs, setting limit
to 10 and offset
to 10 would return bugs 11 through 20 from the set of 100.
op_sys
string
The "Operating System" field of a bug.
platform
string
The Platform (sometimes called "Hardware") field of a bug.
priority
string
The Priority field on a bug.
product
string
The name of the Product that the bug is in.
reporter
string
The login name of the user who reported the bug.
resolution
string
The current resolution--only set if a bug is closed. You can find open bugs by searching for bugs with an empty resolution.
severity
string
The Severity field on a bug.
status
string
The current status of a bug (not including its resolution, if it has one, which is a separate field above).
summary
string
Searches for substrings in the single-line Summary field on bugs. If you specify an array, then bugs whose summaries match any of the passed substrings will be returned.
Note that unlike searching in the Bugzilla UI, substrings are not split on spaces. So searching for foo bar
will match "This is a foo bar" but not "This foo is a bar". ['foo', 'bar']
, would, however, match the second item.
target_milestone
string
The Target Milestone field of a bug. Note that even if this Bugzilla does not have the Target Milestone field enabled, you can still search for bugs by Target Milestone. However, it is likely that in that case, most bugs will not have a Target Milestone set (it defaults to "---" when the field isn't enabled).
qa_contact
string
The login name of the bug's QA Contact. Note that even if this Bugzilla does not have the QA Contact field enabled, you can still search for bugs by QA Contact (though it is likely that no bug will have a QA Contact set, if the field is disabled).
url
string
The "URL" field of a bug.
version
string
The Version field of a bug.
votes
int
Searches for bugs with this many votes or greater. May not be an array.
whiteboard
string
Search the "Status Whiteboard" field on bugs for a substring. Works the same as the summary
field described above, but searches the Status Whiteboard field.
The same as "get".
Note that you will only be returned information about bugs that you can see. Bugs that you can't see will be entirely excluded from the results. So, if you want to see private bugs, you will have to first log in and then call this method.
Currently, this function doesn't throw any special errors (other than the ones that all webservice functions can throw). If you specify an invalid value for a particular field, you just won't get any results for that value.
create
STABLE
This allows you to create a new bug in Bugzilla. If you specify any invalid fields, an error will be thrown stating which field is invalid. If you specify any fields you are not allowed to set, they will just be set to their defaults or ignored.
You cannot currently set all the items here that you can set on enter_bug.cgi.
The WebService interface may allow you to set things other than those listed here, but realize that anything undocumented is UNSTABLE and will very likely change in the future.
Some params must be set, or an error will be thrown. These params are marked Required.
Some parameters can have defaults set in Bugzilla, by the administrator. If these parameters have defaults set, you can omit them. These parameters are marked Defaulted.
Clients that want to be able to interact uniformly with multiple Bugzillas should always set both the params marked Required and those marked Defaulted, because some Bugzillas may not have defaults set for Defaulted parameters, and then this method will throw an error if you don't specify them.
The descriptions of the parameters below are what they mean when Bugzilla is being used to track software bugs. They may have other meanings in some installations.
product
(string) Required - The name of the product the bug is being filed against.component
(string) Required - The name of a component in the product above.summary
(string) Required - A brief description of the bug being filed.version
(string) Required - A version of the product above; the version the bug was found in.description
(string) Defaulted - The initial description for this bug. Some Bugzilla installations require this to not be blank.op_sys
(string) Defaulted - The operating system the bug was discovered on.platform
(string) Defaulted - What type of hardware the bug was experienced on.priority
(string) Defaulted - What order the bug will be fixed in by the developer, compared to the developer's other bugs.severity
(string) Defaulted - How severe the bug is.alias
(string) - A brief alias for the bug that can be used instead of a bug number when accessing this bug. Must be unique in all of this Bugzilla.assigned_to
(username) - A user to assign this bug to, if you don't want it to be assigned to the component owner.cc
(array) - An array of usernames to CC on this bug.qa_contact
(username) - If this installation has QA Contacts enabled, you can set the QA Contact here if you don't want to use the component's default QA Contact.status
(string) - The status that this bug should start out as. Note that only certain statuses can be set on bug creation.target_milestone
(string) - A valid target milestone for this product.In addition to the above parameters, if your installation has any custom fields, you can set them just by passing in the name of the field and its value as a string.
A hash with one element, id
. This is the id of the newly-filed bug.
The component you specified is not valid for this Product.
The alias you specified is invalid for some reason. See the error message for more details.
One of the drop-down fields has an invalid value, or a value entered in a text field is too long. The error message will have more detail.
You didn't specify a component.
Either you didn't specify a product, this product doesn't exist, or you don't have permission to enter bugs in this product.
You didn't specify a summary for the bug.
Either the QA Contact, Assignee, or CC lists have some invalid user in them. The error message will have more details.
add_comment
STABLE
This allows you to add a comment to a bug in Bugzilla.
id
(int or string) Required - The id or alias of the bug to append a comment to.comment
(string) Required - The comment to append to the bug. If this is empty or all whitespace, an error will be thrown saying that you did not set the comment
parameter.is_private
(boolean) - If set to true, the comment is private, otherwise it is assumed to be public.work_time
(double) - Adds this many hours to the "Hours Worked" on the bug. If you are not in the time tracking group, this value will be ignored.A hash with one element, id
whose value is the id of the newly-created comment.
You specified a work_time
larger than the maximum allowed value of 99999.99
.
If you specified an alias and either: (a) the Bugzilla you're querying doesn't support aliases or (b) there is no bug with that alias.
The id you specified doesn't exist in the database.
You did not have the necessary rights to edit the bug.
You tried to add a private comment, but don't have the necessary rights.
You tried to add a comment longer than the maximum allowed length (65,535 characters).
is_private
argument was called private
, and you can still call it private
for backwards-compatibility purposes if you wish.update_see_also
EXPERIMENTAL
Adds or removes URLs for the "See Also" field on bugs. These URLs must point to some valid bug in some Bugzilla installation or in Launchpad.
ids
Array of int
s or string
s. The ids or aliases of bugs that you want to modify.
add
Array of string
s. URLs to Bugzilla bugs. These URLs will be added to the See Also field. They must be valid URLs to show_bug.cgi
in a Bugzilla installation or to a bug filed at launchpad.net.
If the URLs don't start with http://
or https://
, it will be assumed that http://
should be added to the beginning of the string.
It is safe to specify URLs that are already in the "See Also" field on a bug--they will just be silently ignored.
remove
Array of string
s. These URLs will be removed from the See Also field. You must specify the full URL that you want removed. However, matching is done case-insensitively, so you don't have to specify the URL in exact case, if you don't want to.
If you specify a URL that is not in the See Also field of a particular bug, it will just be silently ignored. Invaild URLs are currently silently ignored, though this may change in some future version of Bugzilla.
NOTE: If you specify the same URL in both add
and remove
, it will be added. (That is, add
overrides remove
.)
changes
, a hash where the keys are numeric bug ids and the contents are a hash with one key, see_also
. see_also
points to a hash, which contains two keys, added
and removed
. These are arrays of strings, representing the actual changes that were made to the bug.
Here's a diagram of what the return value looks like for updating bug ids 1 and 2:
{ changes => { 1 => { see_also => { added => (an array of bug URLs), removed => (an array of bug URLs), } }, 2 => { see_also => { added => (an array of bug URLs), removed => (an array of bug URLs), } } } }
This return value allows you to tell what this method actually did. It is in this format to be compatible with the return value of a future Bug.update
method.
This method can throw all of the errors that "get" throws, plus:
You did not have the necessary rights to edit the bug.
One of the URLs you provided did not look like a valid bug URL.
You did not have the necessary rights to edit the See Also field for this bug.