CouchRest.put throws an error

78 views
Skip to first unread message

Divya Varma

unread,
Dec 17, 2011, 12:15:09 AM12/17/11
to CouchRest
Hi,

I need to update a couchdb document, when I and run the following
command in ruby irb

CouchRest.put('http://localhost:5984/db', {"_id": "1","_rev":
"sdf", "test": "testing"})

I get an error -

RestClient::Request::Unauthorized: 401 Unauthorized:
{"error":"unauthorized","reason":"You are not a server admin."}

While in the same console I am able to successfully run -

CouchRest.post('http://localhost:5984/db', {"test": "testing"})

Could somebody help with this please.

Cheers!

Ryan Graham

unread,
May 22, 2012, 1:11:47 PM5/22/12
to couc...@googlegroups.com
In your example, you're creating a DB, which you need admin access for.

It looks like you're trying to create a document, which should be more like:
 CouchRest.put('http://localhost:5984/db/1', { "test": "testing"})

Notice the /1 at the end of the URL, which is the _id you specified in your example.

~Ryan
Reply all
Reply to author
Forward
0 new messages