【bugzila】调用api接口操作bugzila

网上可以查看的bugzila接口

http://bugzilla.readthedocs.io/en/latest/api/core/v1/bug.html

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 here may likely change in the future.

Request

To create a new bug in Bugzilla.

POST /rest/bug
{
  "product" : "TestProduct",
  "component" : "TestComponent",
  "version" : "unspecified",
  "summary" : "'This is a test bug - please disregard",
  "alias" : "SomeAlias",
  "op_sys" : "All",
  "priority" : "P1",
  "rep_platform" : "All"
}

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

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.

name type description
product string The name of the product the bug is being filed against.
component string The name of a component in the product above.
summary string A brief description of the bug being filed.
version string 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 array One or more brief aliases 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 string 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.
comment_is_private boolean If set to true, the description is private, otherwise it is assumed to be public.
comment_tags array An array of strings to add as comment tags for the description.
is_markdown boolean If set to true, the description has Markdown structures; otherwise it is normal text.
groups array An array of group names to put this bug into. You can see valid group names on the Permissions tab of the Preferences screen, or, if you are an administrator, in the Groups control panel. If you don't specify this argument, then the bug will be added into all the groups that are set as being "Default" for this product. (If you want to avoid that, you should specify groups as an empty array.)
keywords array One or more keywords to set on this bug.
qa_contact string 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.
resolution string If you are filing a closed bug, then you will have to specify a resolution. You cannot currently specify a resolution of DUPLICATE for new bugs, though. That must be done with Update Bug.
target_milestone string A valid target milestone for this product.
flags array Flags objects to add to the bug. The object format is described in the Flag object below.

Flag object:

扫描二维码关注公众号,回复: 2346750 查看本文章

To create a flag, at least the status and the type_id or name must be provided. An optional requestee can be passed if the flag type is requestable to a specific user.

name type description
name string The name of the flag type.
type_id int The internal flag type ID.
status string The flags new status (i.e. "?", "+", "-" or "X" to clear flag).
requestee string The login of the requestee if the flag type is requestable to a specific user.

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.

Response

{
  "id" : 12345
}
name type description
id int This is the ID of the newly-filed bug.

Errors

  • 51 (Invalid Object) You specified a field value that is invalid. The error message will have more details.
  • 103 (Invalid Alias) The alias you specified is invalid for some reason. See the error message for more details.
  • 104 (Invalid Field) 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.
  • 105 (Invalid Component) You didn't specify a component.
  • 106 (Invalid Product) Either you didn't specify a product, this product doesn't exist, or you don't have permission to enter bugs in this product.
  • 107 (Invalid Summary) You didn't specify a summary for the bug.
  • 116 (Dependency Loop) You specified values in the "blocks" or "depends_on" fields that would cause a circular dependency between bugs.
  • 120 (Group Restriction Denied) You tried to restrict the bug to a group which does not exist, or which you cannot use with this product.
  • 129 (Flag Status Invalid) The flag status is invalid.
  • 130 (Flag Modification Denied) You tried to request, grant, or deny a flag but only a user with the required permissions may make the change.
  • 131 (Flag not Requestable from Specific Person) You can't ask a specific person for the flag.
  • 133 (Flag Type not Unique) The flag type specified matches several flag types. You must specify the type id value to update or add a flag.
  • 134 (Inactive Flag Type) The flag type is inactive and cannot be used to create new flags.
  • 504 (Invalid User) Either the QA Contact, Assignee, or CC lists have some invalid user in them. The error message will have more details.

对应脚本链接可以参考如下:

创建bug+关闭bug

https://github.com/feifeiyuan/features/tree/master/python/bugzila%E6%8E%A5%E5%8F%A3%E6%93%8D%E4%BD%9C

猜你喜欢

转载自blog.csdn.net/feifei_csdn/article/details/81173545