Friday, 15 July 2011

400 error message when trying to create a new document in CouchDb using XMLHttpRequest -



400 error message when trying to create a new document in CouchDb using XMLHttpRequest -

i trying create new document in couchdb database next code '400 bad request' response. want create document not contain other info _id (and of course of study generated _rev).

var xhrcreate = new xmlhttprequest(); xhrcreate.open('put','http://domainname:5984/dbname/docname/', true); xhrcreate.setrequestheader("content-type", "application/json"); xhrcreate.send();

the couchdb documentation says 400 error indicates a:

"bad request structure. error can indicate error request url, path or headers. differences in supplied md5 hash , content trigger error, may indicate message corruption."

could point me in right direction? hints , help much appreciated.

couchdb requires empty document part of content:

xhrcreate.send('{}');

xmlhttprequest couchdb

No comments:

Post a Comment