Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 27098 invoked from network); 23 Jul 2009 11:05:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jul 2009 11:05:27 -0000 Received: (qmail 36540 invoked by uid 500); 23 Jul 2009 11:06:31 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 36467 invoked by uid 500); 23 Jul 2009 11:06:31 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 36457 invoked by uid 99); 23 Jul 2009 11:06:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 11:06:31 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=NORMAL_HTTP_TO_IP,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of manolopm@gmail.com designates 209.85.218.225 as permitted sender) Received: from [209.85.218.225] (HELO mail-bw0-f225.google.com) (209.85.218.225) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 11:06:21 +0000 Received: by bwz25 with SMTP id 25so904907bwz.11 for ; Thu, 23 Jul 2009 04:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=o64llje9Jjx2SV5XiurOUwkobMRA8+kRUBzDY7TAxnw=; b=MILBavNT6VB1PfEljkW4DQ6ZHoOBVrHmucBJNDpPAoWgVV0+3Iei4PHl9ZcvWqR302 70ZQRKklzzMZnnCkJj1cMNwiwYy/nujQ/HOFBY9oQOON8lqHIA/WwIXuCam8jBqSu5QY 3btVu2eDjqAQN8pnMdtYBmQu5/2sjgko/Ibn8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=aCErkNScRcrXiBaX2rB2lP60XL4F6q14rkTJx8V76dM9AN+Ucb+bxWnAsavj7W3bDv 3XMy8NBhjTyLyGJop2ThIp9hXsP7T5kjhOZ91bJemKP8wak4t7/dqrI42HhX3YcI6wjN D+BXvkafWYLy9EN7fmV8LWQkBgMqmaBN67VYY= MIME-Version: 1.0 Received: by 10.223.114.74 with SMTP id d10mr974598faq.87.1248347161030; Thu, 23 Jul 2009 04:06:01 -0700 (PDT) In-Reply-To: <55fad2460907230355v5943ab0fmd9abb17b1a073409@mail.gmail.com> References: <55fad2460907230355v5943ab0fmd9abb17b1a073409@mail.gmail.com> Date: Thu, 23 Jul 2009 12:06:01 +0100 Message-ID: <55fad2460907230406q22ba54a6n3238cc064ede06@mail.gmail.com> Subject: Re: Problems with Ruby + Json + CouchDB From: Manolo Padron Martinez To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 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' > > =C2=A0id =3D ["603be1d626a743345cf58a55c2f0d6ed"] > > =C2=A0req =3D Net::HTTP::Post.new('http://127.0.0.1:5984/fisica-nist2/_al= l_docs?include_docs=3Dtrue') > =C2=A0req["content-type"] =3D "application/json" > =C2=A0req.body =3D JSON.generate(id) > > =C2=A0res =3D Net::HTTP.start('127.0.0.1', '5984'){|http| > =C2=A0 http.request(req) > =C2=A0} > > I always get an 400 {"error":"bad_request","reason":"Request body must > be a JSON object"} > > Any idea? > > Regards from Canary Islands > > Manuel Padr=C3=B3n Mart=C3=ADnez >