couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manolo Padron Martinez <manol...@gmail.com>
Subject Re: Problems with Ruby + Json + CouchDB
Date Thu, 23 Jul 2009 11:06:01 GMT
I answer myself. I'm a monkey. I was not generating an JSON object
with the property keys, and I forget that I'm doing that in JS because
I was using jquery.couch.js to do that.


On Thu, Jul 23, 2009 at 11:55 AM, Manolo Padron
Martinez<manolopm@gmail.com> wrote:
> 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