Cannot post new bug with REST api

RESOLVED INVALID

Status

RESOLVED INVALID
8 years ago
17 days ago

People

(Reporter: nabeel.ahmad, Assigned: gerv)

Tracking

Details

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
Build Identifier: 3.6.2

I am trying to post a bug using bugzilla REST API. If I supply all the necessary fields of a bug as POST method parameters i get this error "No data supplied for create" with status code 400. Unfortunately I could find any example for reporting a bug with the REST api. I would like to know what I'm doing wrong. I have added a code snippet in "Steps to reproduce"

Reproducible: Always

Steps to Reproduce:
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();
Actual Results:  
Error: No data supplied for create
Status code: 400

Expected Results:  
Report new bug

Updated

8 years ago
Assignee: documentation → gerv
Component: Documentation → BzAPI
Product: Bugzilla → Webtools
QA Contact: default-qa → bzapi
Version: unspecified → Trunk
You are going about this entirely the wrong way. Did you read any of the documentation?
https://wiki.mozilla.org/Bugzilla:REST_API

The documentation for the create call:
https://wiki.mozilla.org/Bugzilla:REST_API:Methods#Create_new_bug_.28.2Fbug_POST.29
says that you need to send a Bug object as the POST body. And you will need to send it as JSON, since that's the only data format the API understands. Raw POST parameters won't work.

Gerv
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INVALID

Updated

17 days ago
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.