incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manolo Padron Martinez <manol...@gmail.com>
Subject Problems with Ruby + Json + CouchDB
Date Thu, 23 Jul 2009 10:55:18 GMT
Hi:

I'm trying to get some documents with the body from CouchDB, I've try
to do it JavaScript and no problem but when I try it in Ruby:


require 'rubygems'
require 'json'
require 'net/http'

 id = ["603be1d626a743345cf58a55c2f0d6ed"]

 req = Net::HTTP::Post.new('http://127.0.0.1:5984/fisica-nist2/_all_docs?include_docs=true')
 req["content-type"] = "application/json"
 req.body = JSON.generate(id)

 res = Net::HTTP.start('127.0.0.1', '5984'){|http|
   http.request(req)
 }

I always get an 400 {"error":"bad_request","reason":"Request body must
be a JSON object"}

Any idea?

Regards from Canary Islands

Manuel Padrón Martínez

Mime
View raw message