如何使用 Bugzilla REST API 发布错误
如何使用 bugzilla rest api 报告错误?以下文档指出 bug 对象或其某些字段必须包含在 POST 正文中。我尝试将字段添加为 POST 方法参数,但收到此错误“未提供用于创建的数据”,状态代码为 400。我的问题是如何在 POST 方法主体中包含 bug 对象或其某些字段?
https://wiki.mozilla.org/Bugzilla:REST_API:方法#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 + "/[email protected]&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();
How can I report a bug with bugzilla rest api? The following document states that the bug object or a some of its fields must be included in POST body. I have tried adding the fields as POST method parameters but i get this error "No data supplied for create" with status code 400. My question is that how can I include a bug object or some of its fields in the POST method body??
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 + "/[email protected]&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();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将数据格式化为 JSON 而不是 post params。 create的请求类型仍然是POST,但是body需要是JSON。
You need to format your data as JSON instead of post params. The request type for create is still POST, but the body needs to be JSON.