gpt4 book ai didi

api - 如何使用 Bugzilla REST API 发布错误

转载 作者:行者123 更新时间:2023-12-04 22:15:47 24 4
gpt4 key购买 nike

如何报告 bugzilla rest api 的错误?以下文档指出错误对象或其某些字段必须包含在 POST 正文中。我曾尝试将字段添加为 POST 方法参数,但出现此错误“未提供用于创建的数据”,状态代码为 400。我的问题是如何在 POST 方法主体中包含错误对象或其某些字段?

https://wiki.mozilla.org/Bugzilla:REST_API:Methods#Create_new_bug_.28.2Fbug_POST.29

String serverURL = "https://api-dev.bugzilla.mozilla.org/test/latest";
String product = "FoodReplicator";
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(serverURL + "/bug?username=abc@xyz.com&password=123456);
method.addParameter("product", "FoodReplicator");
method.addParameter("component", "Salt");
method.addParameter("summary", "testing");
method.addParameter("version", "1.0");
client.executeMethod(method);
return method.getStatusCode() + " " + method.getResponseBodyAsString();

最佳答案

您需要将数据格式化为 JSON 而不是 post params。 create 的请求类型仍然是 POST,但 body 需要是 JSON。

关于api - 如何使用 Bugzilla REST API 发布错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3751635/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com