coldfusion - How to create a new CouchDB User without Futon or Curl? -


i'm searching way create new couchdb user without using futon or curl... straight http request.

one way found (http://stackoverflow.com/questions/3456256/error-creating-user-in-couchdb-1-0) puts json doc "http://localhost:5984/_users/org.couchdb.user:username" create user.

i have attempted following:

<cfhttp url="http://127.0.0.1/_users/org.couchdb.user:xyz_company" port="5984" method="put" username="#variables.couch_username#" password="#variables.couch_password#"> <cfhttpparam type="header" name="content-type" value="application/json"> <cfhttpparam type='body' name='org.couchdb.user:xyz_company' value='{"roles":[],"name":"xyz_company","salt":"3b33bf09-26b9-d60a-8f469d01286e9590","id":"org.couchdb.user:xyz_company","password_sha":"096ea41a5a81ea1507f2c6f7edc364c0b82694ac","type":"user"}'> 

i keep receiving following couch:

cfhttp.statuscode = 405 method not allowed cfhttp.filecontent = method not allowed; requested method put not allowed url /_users/org.couchdb.user:xyz_company

any thoughts or suggestions?

update:

i edited code based on marcello's suggestions. still receive same 405 method not allowed error. here code now:

<cfhttp url="http://127.0.0.1/_users/org.couchdb.user:xyz_company" port="5984" method="put" username="#variables.couch_username#" password="#variables.couch_password#"><cfhttpparam type="header" name="content-type" value="application/json;charset=utf-8"><cfhttpparam type='body' value='{"roles":[],"name":"xyz_company","salt":"3b33bf09-26b9-d60a-8f469d01286e9590","_id":"org.couchdb.user:xyz_company","password_sha":"096ea41a5a81ea1507f2c6f7edc364c0b82694ac","type":"user"}'></cfhttp> 

any more suggestions? thank you!

curl is straight http request. there other ways create such requests: can craft them browser; can use different program (e.g. wget); or write own (e.g. in python or in javascript v8 or rhino).


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -