首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Bugzilla Restful Api在Bugzilla中创建错误

使用Bugzilla Restful Api在Bugzilla中创建错误
EN

Stack Overflow用户
提问于 2017-03-06 17:48:17
回答 3查看 1.6K关注 0票数 1

有没有使用restful webservice API在Bugzilla中创建新bug的示例代码?到目前为止,我所做的就是使用Postman来看看它是如何工作的:

简单的json代码:

代码语言:javascript
复制
{
    "product" : "TestProduct",
    "component" : "TestComponent",
    "summary" : "This is the best bug report",
    "version" : "unspecified",
    "description" : "This is the best GUI for reporting bugs"
}

这是端点:

代码语言:javascript
复制
http://localhost/bugzilla/rest.cgi/rest/bug

我得到的错误日志如下:

代码语言:javascript
复制
{
  "code": 32614,
  "message": "A REST API resource was not found for 'POST /rest/bug'.",
  "documentation": "https://bugzilla.readthedocs.org/en/5.0/api/",
  "error": true
}
EN

回答 3

Stack Overflow用户

发布于 2017-08-31 05:09:05

一个用python编写的示例,使用rest API在Bugzilla 5.x中创建一个bug。

代码语言:javascript
复制
import requests

data = {
    "product" : "TestProduct",
    "component" : "TestComponent",
    "summary" : "This is the best bug report",
    "version" : "unspecified",
    "description" : "This is the best GUI for reporting bugs"
}
url_bz_restapi = 'http://localhost/bugzilla/rest.cgi/bug'
r = requests.post(url_bz_restapi, data=data)
票数 1
EN

Stack Overflow用户

发布于 2018-05-15 18:30:39

通过/rest/login?login=foo@example.com&password=toosecrettoshow接口创建一个新的token

代码语言:javascript
复制
import requests

url = 'http://localhost/bugzilla/rest.cgi/bug?token=GENERATED TOKEN' 
data = {   
"product" : "TestProduct",   
"component" : "TestComponent", 
"version" : "unspecified",   
"summary" : "'This is a test bug - please disregard",   
"alias" : "Somlias",   
"op_sys" : "All",  
"priority" : "---",   
"rep_platform" : "All" 
}

def create_bug(url,data):   
    test = requests.post(url,data=data)     
    return test.json()

create_bug(url,data)
票数 0
EN

Stack Overflow用户

发布于 2020-07-17 19:33:07

使用Rest客户端

网址:http:///bugzilla/rest.cgi/bug

方法: POST

Basic Auth: token:gentoken

JSON:

{

"product“:"Ashok",

"component“:”测试“,

"version“:”未指定“,

"summary“:”‘这是一个测试错误-来自JSON“

}

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42622313

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档