Closed Bug 599336 Opened 16 years ago Closed 16 years ago

Cannot post new bug with REST api

Categories

(Webtools Graveyard :: BzAPI, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: nabeel.ahmad, Assigned: gerv)

Details

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
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
Closed: 16 years ago
Resolution: --- → INVALID
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.