有没有使用restful webservice API在Bugzilla中创建新bug的示例代码?到目前为止,我所做的就是使用Postman来看看它是如何工作的:
简单的json代码:
{
"product" : "TestProduct",
"component" : "TestComponent",
"summary" : "This is the best bug report",
"version" : "unspecified",
"description" : "This is the best GUI for reporting bugs"
}这是端点:
http://localhost/bugzilla/rest.cgi/rest/bug我得到的错误日志如下:
{
"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
}发布于 2017-08-31 05:09:05
一个用python编写的示例,使用rest API在Bugzilla 5.x中创建一个bug。
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)发布于 2018-05-15 18:30:39
通过/rest/login?login=foo@example.com&password=toosecrettoshow接口创建一个新的token
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)发布于 2020-07-17 19:33:07
使用Rest客户端
网址:http:///bugzilla/rest.cgi/bug
方法: POST
Basic Auth: token:gentoken
JSON:
{
"product“:"Ashok",
"component“:”测试“,
"version“:”未指定“,
"summary“:”‘这是一个测试错误-来自JSON“
}
https://stackoverflow.com/questions/42622313
复制相似问题