<<

Bugzilla::Webservice::Product

NAME

Bugzilla::Webservice::Product - The Product API

DESCRIPTION

This part of the Bugzilla API allows you to list the available Products and get information about them.

METHODS

See Bugzilla::WebService for a description of how parameters are passed, and what STABLE, UNSTABLE, and EXPERIMENTAL mean.

Although the data input and output is the same for JSONRPC, XMLRPC and REST, the directions for how to access the data via REST is noted in each method where applicable.

List Products

get_selectable_products

EXPERIMENTAL

Description

Returns a list of the ids of the products the user can search on.

REST

GET /rest/product_selectable

the returned data format is same as below.

Params (none)
Returns

A hash containing one item, ids, that contains an array of product ids.

Errors (none)
History
REST API call added in Bugzilla 5.0.

get_enterable_products

EXPERIMENTAL

Description

Returns a list of the ids of the products the user can enter bugs against.

REST

GET /rest/product_enterable

the returned data format is same as below.

Params (none)
Returns

A hash containing one item, ids, that contains an array of product ids.

Errors (none)
History
REST API call added in Bugzilla 5.0.

get_accessible_products

UNSTABLE

Description

Returns a list of the ids of the products the user can search or enter bugs against.

REST

GET /rest/product_accessible

the returned data format is same as below.

Params (none)
Returns

A hash containing one item, ids, that contains an array of product ids.

Errors (none)
History
REST API call added in Bugzilla 5.0.

get

EXPERIMENTAL

Description

Returns a list of information about the products passed to it.

Note: You must at least specify one of ids or names.

REST

To return information about a specific groups of products such as accessible, selectable, or enterable:

GET /rest/product?type=accessible

To return information about a specific product by id or name:

GET /rest/product/<product_id_or_name>

You can also return information about more than one specific product by using the following in your query string:

GET /rest/product?ids=1&ids=2&ids=3 or GET /product?names=ProductOne&names=Product2

the returned data format is same as below.

Params

In addition to the parameters below, this method also accepts the standard include_fields and exclude_fields arguments.

This RPC call supports sub field restrictions.

ids

An array of product ids

names

An array of product names

type

The group of products to return. Valid values are: accessible (default), selectable, and enterable. type can be a single value or an array of values if more than one group is needed with duplicates removed.

Returns

A hash containing one item, products, that is an array of hashes. Each hash describes a product, and has the following items:

id

int An integer id uniquely identifying the product in this installation only.

name

string The name of the product. This is a unique identifier for the product.

description

string A description of the product, which may contain HTML.

is_active

boolean A boolean indicating if the product is active.

default_milestone

string The name of the default milestone for the product.

has_unconfirmed

boolean Indicates whether the UNCONFIRMED bug status is available for this product.

classification

string The classification name for the product.

components

array An array of hashes, where each hash describes a component, and has the following items:

id

int An integer id uniquely identifying the component in this installation only.

name

string The name of the component. This is a unique identifier for this component.

description

string A description of the component, which may contain HTML.

default_assigned_to

string The login name of the user to whom new bugs will be assigned by default.

default_qa_contact

string The login name of the user who will be set as the QA Contact for new bugs by default. Empty string if the QA contact is not defined.

sort_key

int Components, when displayed in a list, are sorted first by this integer and then secondly by their name.

is_active

boolean A boolean indicating if the component is active. Inactive components are not enabled for new bugs.

flag_types

A hash containing the two items bug and attachment that each contains an array of hashes, where each hash describes a flagtype, and has the following items:

id

int Returns the ID of the flagtype.

name

string Returns the name of the flagtype.

description

string Returns the description of the flagtype.

cc_list

string Returns the concatenated CC list for the flagtype, as a single string.

sort_key

int Returns the sortkey of the flagtype.

is_active

boolean Returns whether the flagtype is active or disabled. Flags being in a disabled flagtype are not deleted. It only prevents you from adding new flags to it.

is_requestable

boolean Returns whether you can request for the given flagtype (i.e. whether the '?' flag is available or not).

is_requesteeble

boolean Returns whether you can ask someone specifically or not.

is_multiplicable

boolean Returns whether you can have more than one flag for the given flagtype in a given bug/attachment.

grant_group

int the group id that is allowed to grant/deny flags of this type. If the item is not included all users are allowed to grant/deny this flagtype.

request_group

int the group id that is allowed to request the flag if the flag is of the type requestable. If the item is not included all users are allowed request this flagtype.

versions

array An array of hashes, where each hash describes a version, and has the following items: name, sort_key and is_active.

milestones

array An array of hashes, where each hash describes a milestone, and has the following items: name, sort_key and is_active.

Note, that if the user tries to access a product that is not in the list of accessible products for the user, or a product that does not exist, that is silently ignored, and no information about that product is returned.

Errors (none)
History
In Bugzilla 4.2, names was added as an input parameter.
In Bugzilla 4.2, classification, components, versions, milestones, default_milestone and has_unconfirmed were added to the fields returned by get as a replacement for internals, which has been removed.
In Bugzilla 4.4, flag_types was added to the fields returned by get.
REST API call added in Bugzilla 5.0.

Product Creation and Modification

create

EXPERIMENTAL

Description

This allows you to create a new product in Bugzilla.

REST

POST /rest/product

The params to include in the POST body as well as the returned data format, are the same as below.

Params

Some params must be set, or an error will be thrown. These params are marked Required.

name

Required string The name of this product. Must be globally unique within Bugzilla.

description

Required string A description for this product. Allows some simple HTML.

version

Required string The default version for this product.

has_unconfirmed

boolean Allow the UNCONFIRMED status to be set on bugs in this product. Default: true.

classification

string The name of the Classification which contains this product.

default_milestone

string The default milestone for this product. Default '---'.

is_open

boolean True if the product is currently allowing bugs to be entered into it. Default: true.

create_series

boolean True if you want series for New Charts to be created for this new product. Default: true.

Returns

A hash with one element, id. This is the id of the newly-filed product.

Errors
51 (Classification does not exist)

You must specify an existing classification name.

700 (Product blank name)

You must specify a non-blank name for this product.

701 (Product name too long)

The name specified for this product was longer than the maximum allowed length.

702 (Product name already exists)

You specified the name of a product that already exists. (Product names must be globally unique in Bugzilla.)

703 (Product must have description)

You must specify a description for this product.

704 (Product must have version)

You must specify a version for this product.

History
REST API call added in Bugzilla 5.0.

update

EXPERIMENTAL

Description

This allows you to update a product in Bugzilla.

REST

PUT /rest/product/<product_id_or_name>

The params to include in the PUT body as well as the returned data format, are the same as below. The ids and names params will be overridden as it is pulled from the URL path.

Params

Note: The following parameters specify which products you are updating. You must set one or both of these parameters.

ids

array of ints. Numeric ids of the products that you wish to update.

names

array or strings. Names of the products that you wish to update.

Note: The following parameters specify the new values you want to set for the products you are updating.

name

string A new name for this product. If you try to set this while updating more than one product, an error will occur, as product names must be unique.

default_milestone

string When a new bug is filed, what milestone does it get by default if the user does not choose one? Must represent a milestone that is valid for this product.

description

string Update the long description for these products to this value.

has_unconfirmed

boolean Allow the UNCONFIRMED status to be set on bugs in products.

is_open

boolean True if the product is currently allowing bugs to be entered into it, False otherwise.

Returns

A hash with a single field "products". This points to an array of hashes with the following fields:

id

int The id of the product that was updated.

changes

hash The changes that were actually done on this product. The keys are the names of the fields that were changed, and the values are a hash with two keys:

added

string The value that this field was changed to.

removed

string The value that was previously set in this field.

Note that booleans will be represented with the strings '1' and '0'.

Here's an example of what a return value might look like:

 {
   products => [
     {
       id => 123,
       changes => {
         name => {
           removed => 'FooName',
           added   => 'BarName'
         },
         has_unconfirmed => {
           removed => '1',
           added   => '0',
         }
       }
     }
   ]
 }
Errors
700 (Product blank name)

You must specify a non-blank name for this product.

701 (Product name too long)

The name specified for this product was longer than the maximum allowed length.

702 (Product name already exists)

You specified the name of a product that already exists. (Product names must be globally unique in Bugzilla.)

703 (Product must have description)

You must specify a description for this product.

705 (Product must define a default milestone)

You must define a default milestone.

History
Added in Bugzilla 4.4.
REST API call added in Bugzilla 5.0.

<<