incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erich oliphant <erich.oliph...@gmail.com>
Subject Re: "invalid UTF-8 JSON" 400 error accessing view with 'key' parameter
Date Wed, 17 Mar 2010 00:49:01 GMT
Thanks worked like a charm!

On Tue, Mar 16, 2010 at 8:45 PM, Jan Lehnardt <jan@apache.org> wrote:

> Hi Erich,
>
> On 16 Mar 2010, at 19:33, erich oliphant wrote:
>
> > I am a new CouchDB user.
>
> Welcome :)
>
> > I've populated my db with some documents and I've
> > begun delving into views.  I have a simple view that seems to work fine
> with
> > no params, like so:
> >
> > curl -X GET
> http://localhost:5984/testerp1/_design/onestop/_view/PONumbers
> > {"total_rows":104,"offset":0,"rows":[
> >
> {"id":"d15d7d12-af01-4137-b56e-2bb2fdea5721","key":"AAA-99036","value":"d15d7d12-af01-4137-b56e-2bb2fdea5721"},
> >
> {"id":"3e1d30ba-759f-4bff-b6c7-64536d772b09","key":"AAA-99057","value":"3e1d30ba-759f-4bff-b6c7-64536d772b09"},
> > ...
> > However trying to grab a single result, causes a 400
> > curl -vX GET
> > http://localhost:5984/testerp1/_design/onestop/_view/PONumbers?key=
> > "AAA-99057"
>
> Your shell interprets the double quotes. Try this:
>
>  curl -vX GET '
> http://localhost:5984/testerp1/_design/onestop/_view/PONumbers?key=
> "AAA-99057"'
>
> Cheers
> Jan
> --
>
>
>
> > * About to connect() to localhost port 5984 (#0)
> > *   Trying ::1... Connection refused
> > *   Trying fe80::1... Connection refused
> > *   Trying 127.0.0.1... connected
> > * Connected to localhost (127.0.0.1) port 5984 (#0)
> >> GET /testerp1/_design/onestop/_view/PONumbers?key=AAA-99057 HTTP/1.1
> >> User-Agent: curl/7.20.0 (i386-apple-darwin10.2.0) libcurl/7.20.0
> > OpenSSL/0.9.8m zlib/1.2.4 libidn/1.16
> >> Host: localhost:5984
> >> Accept: */*
> >>
> > < HTTP/1.1 400 Bad Request
> > < Server: CouchDB/0.10.1 (Erlang OTP/R13B)
> > < Date: Wed, 17 Mar 2010 00:28:46 GMT
> > < Content-Type: text/plain;charset=utf-8
> > < Content-Length: 54
> > < Cache-Control: must-revalidate
> > <
> > {"error":"bad_request","reason":"invalid UTF-8 JSON"}
> > * Connection #0 to host localhost left intact
> > * Closing connection #0
> >
> > I've tried the key param with and without quotes,etc but get the same
> > issue.   All of the other issues I've seen online have been related to
> PUT
> > bodies not being encoded correctly, but I've seen nothing similar to my
> > case.
> >
> > Thanks In Advance
> > --
> > Erich Oliphant
> >
> > "There are, in fact, two things, science and opinion, the former begets
> > knowledge, the latter ignorance"
> > -- Hippocrates of Cos
>
>


-- 
Erich Oliphant

"There are, in fact, two things, science and opinion, the former begets
knowledge, the latter ignorance"
-- Hippocrates of Cos

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message