You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Peter Frisch <pe...@vervis.de> on 2010/10/14 10:54:02 UTC
Fetch multiple Documents with a single request
I was very happy to find the apache wiki page about fetching bulk documents with one request. Unfortunately I always receive a error message claiming that my request was no valid JSON. After staring at my request for half an hour I still can't find a malformed JSON there:
curl -d '{"keys":["1-7987539b0f7c047728dbd21b16fe442e"]}' -X POST http://whatever/codebluebig/_all_docs
Has anyone an idea what the problem might be?
Re: Fetch multiple Documents with a single request
Posted by Benoit Chesneau <bc...@gmail.com>.
On Thu, Oct 14, 2010 at 11:43 AM, Quentin Pradet
<qu...@gmail.com> wrote:
> Hi,
>
> This exact command works with CouchDB 1.0.1:
>
> curl -d '{"keys":["ee3fb428027b028fe5edf3df2cfff36c",
> "ee3fb428027b028fe5edf3df2cffd258"]}' -X POST '
> http://localhost:5984/mesures/_all_docs?include_docs=true'
>
> I did not need to specify the content-type, and even when I
> specified it (correctly or the way you did it) it did work as
> expected.
>
You're right. it isn't needed yet.
- benoit
Re: Fetch multiple Documents with a single request
Posted by Benoit Chesneau <bc...@gmail.com>.
On Thu, Oct 14, 2010 at 1:19 PM, Peter Frisch <pe...@vervis.de> wrote:
> Thanks a lot Cliff and Mark,
>
> Both ways work now. You guys saved my day :)
>
> Cheers, Peter
>
On a side note, the header will be needed in coming version.
- benoît
RE: Fetch multiple Documents with a single request
Posted by Peter Frisch <pe...@vervis.de>.
Thanks a lot Cliff and Mark,
Both ways work now. You guys saved my day :)
Cheers, Peter
-----Original Message-----
From: Mark J. Reed [mailto:markjreed@gmail.com]
Sent: Donnerstag, 14. Oktober 2010 13:19
To: user@couchdb.apache.org
Subject: Re: Fetch multiple Documents with a single request
Single quotes don't work on Win command line. Write the data to a
file and use -d@filename.
On Thursday, October 14, 2010, Peter Frisch <pe...@vervis.de> wrote:
> Hi Cliff,
>
> It's windows. I just tried on Linux and it works! Thanks for the hint ... Any idea what I would have to change, to make it work on windows?
>
> Cheers, Peter
>
> -----Original Message-----
> From: Cliff Williams [mailto:cliffywills@aol.com]
> Sent: Donnerstag, 14. Oktober 2010 12:54
> To: user@couchdb.apache.org
> Subject: Re: Fetch multiple Documents with a single request
>
> Peter,
>
> what host are you running curl from ?? is it Linux or Windows ??
>
> best regards
>
> cliff
>
>
> On 14/10/10 11:08, Peter Frisch wrote:
>> I'm using couchDB 1.0.1 and it doesn't work, no matter, if I use the header option or not ...
>> Might it be a setting within the couchDB or on the http server? Any other ideas?
>>
>> -----Original Message-----
>> From: Quentin Pradet [mailto:quentin.pradet@gmail.com]
>> Sent: Donnerstag, 14. Oktober 2010 11:44
>> To: user@couchdb.apache.org
>> Subject: Re: Fetch multiple Documents with a single request
>>
>> Hi,
>>
>> This exact command works with CouchDB 1.0.1:
>>
>> curl -d '{"keys":["ee3fb428027b028fe5edf3df2cfff36c",
>> "ee3fb428027b028fe5edf3df2cffd258"]}' -X POST '
>> http://localhost:5984/mesures/_all_docs?include_docs=true'
>>
>> I did not need to specify the content-type, and even when I
>> specified it (correctly or the way you did it) it did work as
>> expected.
>>
>> On Thu, Oct 14, 2010 at 1:40 PM, Benoit Chesneau<bc...@gmail.com>wrote:
>>
>>> On Thu, Oct 14, 2010 at 11:29 AM, Peter Frisch<pe...@vervis.de>
>>> wrote:
>>>> My next attempts looked like this:
>>>>
>>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>>> "1284,133491,420777@default"]}' -H 'Content-Type=application/json' -X POST
>>> http://whatever/codebluebig/_all_docs?include_docs=true
>>>> and
>>>>
>>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>>> "1284,133491,420777@default"]}' -H "Content-Type=application/json" -X POST
>>> http://whatever/codebluebig/_all_docs?include_docs=true
>>>> and still resulted in:
>>>>
>>>> {"error":"bad_request","reason":"invalid UTF-8 JSON"}
>>>>
>>>> Any other thoughts?
>>>>
>>>
>>> "=" != ":" (in your header declaration)
>>>
>
--
Mark J. Reed <ma...@gmail.com>
Re: Fetch multiple Documents with a single request
Posted by "Mark J. Reed" <ma...@gmail.com>.
Single quotes don't work on Win command line. Write the data to a
file and use -d@filename.
On Thursday, October 14, 2010, Peter Frisch <pe...@vervis.de> wrote:
> Hi Cliff,
>
> It's windows. I just tried on Linux and it works! Thanks for the hint ... Any idea what I would have to change, to make it work on windows?
>
> Cheers, Peter
>
> -----Original Message-----
> From: Cliff Williams [mailto:cliffywills@aol.com]
> Sent: Donnerstag, 14. Oktober 2010 12:54
> To: user@couchdb.apache.org
> Subject: Re: Fetch multiple Documents with a single request
>
> Peter,
>
> what host are you running curl from ?? is it Linux or Windows ??
>
> best regards
>
> cliff
>
>
> On 14/10/10 11:08, Peter Frisch wrote:
>> I'm using couchDB 1.0.1 and it doesn't work, no matter, if I use the header option or not ...
>> Might it be a setting within the couchDB or on the http server? Any other ideas?
>>
>> -----Original Message-----
>> From: Quentin Pradet [mailto:quentin.pradet@gmail.com]
>> Sent: Donnerstag, 14. Oktober 2010 11:44
>> To: user@couchdb.apache.org
>> Subject: Re: Fetch multiple Documents with a single request
>>
>> Hi,
>>
>> This exact command works with CouchDB 1.0.1:
>>
>> curl -d '{"keys":["ee3fb428027b028fe5edf3df2cfff36c",
>> "ee3fb428027b028fe5edf3df2cffd258"]}' -X POST '
>> http://localhost:5984/mesures/_all_docs?include_docs=true'
>>
>> I did not need to specify the content-type, and even when I
>> specified it (correctly or the way you did it) it did work as
>> expected.
>>
>> On Thu, Oct 14, 2010 at 1:40 PM, Benoit Chesneau<bc...@gmail.com>wrote:
>>
>>> On Thu, Oct 14, 2010 at 11:29 AM, Peter Frisch<pe...@vervis.de>
>>> wrote:
>>>> My next attempts looked like this:
>>>>
>>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>>> "1284,133491,420777@default"]}' -H 'Content-Type=application/json' -X POST
>>> http://whatever/codebluebig/_all_docs?include_docs=true
>>>> and
>>>>
>>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>>> "1284,133491,420777@default"]}' -H "Content-Type=application/json" -X POST
>>> http://whatever/codebluebig/_all_docs?include_docs=true
>>>> and still resulted in:
>>>>
>>>> {"error":"bad_request","reason":"invalid UTF-8 JSON"}
>>>>
>>>> Any other thoughts?
>>>>
>>>
>>> "=" != ":" (in your header declaration)
>>>
>
--
Mark J. Reed <ma...@gmail.com>
Re: Fetch multiple Documents with a single request
Posted by Cliff Williams <cl...@aol.com>.
Peter,
:-)
You have two options one is to escape all quotes ie \" in your json
string which is really quite horrible or two to put json into a file and
use -d @filename (i think), which I would consider to be the better choice.
Best regards
Cliff
On 14/10/10 12:01, Peter Frisch wrote:
> Hi Cliff,
>
> It's windows. I just tried on Linux and it works! Thanks for the hint ... Any idea what I would have to change, to make it work on windows?
>
> Cheers, Peter
>
> -----Original Message-----
> From: Cliff Williams [mailto:cliffywills@aol.com]
> Sent: Donnerstag, 14. Oktober 2010 12:54
> To: user@couchdb.apache.org
> Subject: Re: Fetch multiple Documents with a single request
>
> Peter,
>
> what host are you running curl from ?? is it Linux or Windows ??
>
> best regards
>
> cliff
>
>
> On 14/10/10 11:08, Peter Frisch wrote:
>> I'm using couchDB 1.0.1 and it doesn't work, no matter, if I use the header option or not ...
>> Might it be a setting within the couchDB or on the http server? Any other ideas?
>>
>> -----Original Message-----
>> From: Quentin Pradet [mailto:quentin.pradet@gmail.com]
>> Sent: Donnerstag, 14. Oktober 2010 11:44
>> To: user@couchdb.apache.org
>> Subject: Re: Fetch multiple Documents with a single request
>>
>> Hi,
>>
>> This exact command works with CouchDB 1.0.1:
>>
>> curl -d '{"keys":["ee3fb428027b028fe5edf3df2cfff36c",
>> "ee3fb428027b028fe5edf3df2cffd258"]}' -X POST '
>> http://localhost:5984/mesures/_all_docs?include_docs=true'
>>
>> I did not need to specify the content-type, and even when I
>> specified it (correctly or the way you did it) it did work as
>> expected.
>>
>> On Thu, Oct 14, 2010 at 1:40 PM, Benoit Chesneau<bc...@gmail.com>wrote:
>>
>>> On Thu, Oct 14, 2010 at 11:29 AM, Peter Frisch<pe...@vervis.de>
>>> wrote:
>>>> My next attempts looked like this:
>>>>
>>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>>> "1284,133491,420777@default"]}' -H 'Content-Type=application/json' -X POST
>>> http://whatever/codebluebig/_all_docs?include_docs=true
>>>> and
>>>>
>>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>>> "1284,133491,420777@default"]}' -H "Content-Type=application/json" -X POST
>>> http://whatever/codebluebig/_all_docs?include_docs=true
>>>> and still resulted in:
>>>>
>>>> {"error":"bad_request","reason":"invalid UTF-8 JSON"}
>>>>
>>>> Any other thoughts?
>>>>
>>> "=" != ":" (in your header declaration)
>>>
RE: Fetch multiple Documents with a single request
Posted by Peter Frisch <pe...@vervis.de>.
Hi Cliff,
It's windows. I just tried on Linux and it works! Thanks for the hint ... Any idea what I would have to change, to make it work on windows?
Cheers, Peter
-----Original Message-----
From: Cliff Williams [mailto:cliffywills@aol.com]
Sent: Donnerstag, 14. Oktober 2010 12:54
To: user@couchdb.apache.org
Subject: Re: Fetch multiple Documents with a single request
Peter,
what host are you running curl from ?? is it Linux or Windows ??
best regards
cliff
On 14/10/10 11:08, Peter Frisch wrote:
> I'm using couchDB 1.0.1 and it doesn't work, no matter, if I use the header option or not ...
> Might it be a setting within the couchDB or on the http server? Any other ideas?
>
> -----Original Message-----
> From: Quentin Pradet [mailto:quentin.pradet@gmail.com]
> Sent: Donnerstag, 14. Oktober 2010 11:44
> To: user@couchdb.apache.org
> Subject: Re: Fetch multiple Documents with a single request
>
> Hi,
>
> This exact command works with CouchDB 1.0.1:
>
> curl -d '{"keys":["ee3fb428027b028fe5edf3df2cfff36c",
> "ee3fb428027b028fe5edf3df2cffd258"]}' -X POST '
> http://localhost:5984/mesures/_all_docs?include_docs=true'
>
> I did not need to specify the content-type, and even when I
> specified it (correctly or the way you did it) it did work as
> expected.
>
> On Thu, Oct 14, 2010 at 1:40 PM, Benoit Chesneau<bc...@gmail.com>wrote:
>
>> On Thu, Oct 14, 2010 at 11:29 AM, Peter Frisch<pe...@vervis.de>
>> wrote:
>>> My next attempts looked like this:
>>>
>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>> "1284,133491,420777@default"]}' -H 'Content-Type=application/json' -X POST
>> http://whatever/codebluebig/_all_docs?include_docs=true
>>> and
>>>
>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>> "1284,133491,420777@default"]}' -H "Content-Type=application/json" -X POST
>> http://whatever/codebluebig/_all_docs?include_docs=true
>>> and still resulted in:
>>>
>>> {"error":"bad_request","reason":"invalid UTF-8 JSON"}
>>>
>>> Any other thoughts?
>>>
>>
>> "=" != ":" (in your header declaration)
>>
Re: Fetch multiple Documents with a single request
Posted by Cliff Williams <cl...@aol.com>.
Peter,
what host are you running curl from ?? is it Linux or Windows ??
best regards
cliff
On 14/10/10 11:08, Peter Frisch wrote:
> I'm using couchDB 1.0.1 and it doesn't work, no matter, if I use the header option or not ...
> Might it be a setting within the couchDB or on the http server? Any other ideas?
>
> -----Original Message-----
> From: Quentin Pradet [mailto:quentin.pradet@gmail.com]
> Sent: Donnerstag, 14. Oktober 2010 11:44
> To: user@couchdb.apache.org
> Subject: Re: Fetch multiple Documents with a single request
>
> Hi,
>
> This exact command works with CouchDB 1.0.1:
>
> curl -d '{"keys":["ee3fb428027b028fe5edf3df2cfff36c",
> "ee3fb428027b028fe5edf3df2cffd258"]}' -X POST '
> http://localhost:5984/mesures/_all_docs?include_docs=true'
>
> I did not need to specify the content-type, and even when I
> specified it (correctly or the way you did it) it did work as
> expected.
>
> On Thu, Oct 14, 2010 at 1:40 PM, Benoit Chesneau<bc...@gmail.com>wrote:
>
>> On Thu, Oct 14, 2010 at 11:29 AM, Peter Frisch<pe...@vervis.de>
>> wrote:
>>> My next attempts looked like this:
>>>
>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>> "1284,133491,420777@default"]}' -H 'Content-Type=application/json' -X POST
>> http://whatever/codebluebig/_all_docs?include_docs=true
>>> and
>>>
>>> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
>> "1284,133491,420777@default"]}' -H "Content-Type=application/json" -X POST
>> http://whatever/codebluebig/_all_docs?include_docs=true
>>> and still resulted in:
>>>
>>> {"error":"bad_request","reason":"invalid UTF-8 JSON"}
>>>
>>> Any other thoughts?
>>>
>>
>> "=" != ":" (in your header declaration)
>>
RE: Fetch multiple Documents with a single request
Posted by Peter Frisch <pe...@vervis.de>.
I'm using couchDB 1.0.1 and it doesn't work, no matter, if I use the header option or not ...
Might it be a setting within the couchDB or on the http server? Any other ideas?
-----Original Message-----
From: Quentin Pradet [mailto:quentin.pradet@gmail.com]
Sent: Donnerstag, 14. Oktober 2010 11:44
To: user@couchdb.apache.org
Subject: Re: Fetch multiple Documents with a single request
Hi,
This exact command works with CouchDB 1.0.1:
curl -d '{"keys":["ee3fb428027b028fe5edf3df2cfff36c",
"ee3fb428027b028fe5edf3df2cffd258"]}' -X POST '
http://localhost:5984/mesures/_all_docs?include_docs=true'
I did not need to specify the content-type, and even when I
specified it (correctly or the way you did it) it did work as
expected.
On Thu, Oct 14, 2010 at 1:40 PM, Benoit Chesneau <bc...@gmail.com>wrote:
> On Thu, Oct 14, 2010 at 11:29 AM, Peter Frisch <pe...@vervis.de>
> wrote:
> > My next attempts looked like this:
> >
> > curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
> "1284,133491,420777@default"]}' -H 'Content-Type=application/json' -X POST
> http://whatever/codebluebig/_all_docs?include_docs=true
> >
> > and
> >
> > curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
> "1284,133491,420777@default"]}' -H "Content-Type=application/json" -X POST
> http://whatever/codebluebig/_all_docs?include_docs=true
> >
> > and still resulted in:
> >
> > {"error":"bad_request","reason":"invalid UTF-8 JSON"}
> >
> > Any other thoughts?
> >
>
>
> "=" != ":" (in your header declaration)
>
Re: Fetch multiple Documents with a single request
Posted by Quentin Pradet <qu...@gmail.com>.
Hi,
This exact command works with CouchDB 1.0.1:
curl -d '{"keys":["ee3fb428027b028fe5edf3df2cfff36c",
"ee3fb428027b028fe5edf3df2cffd258"]}' -X POST '
http://localhost:5984/mesures/_all_docs?include_docs=true'
I did not need to specify the content-type, and even when I
specified it (correctly or the way you did it) it did work as
expected.
On Thu, Oct 14, 2010 at 1:40 PM, Benoit Chesneau <bc...@gmail.com>wrote:
> On Thu, Oct 14, 2010 at 11:29 AM, Peter Frisch <pe...@vervis.de>
> wrote:
> > My next attempts looked like this:
> >
> > curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
> "1284,133491,420777@default"]}' -H 'Content-Type=application/json' -X POST
> http://whatever/codebluebig/_all_docs?include_docs=true
> >
> > and
> >
> > curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82",
> "1284,133491,420777@default"]}' -H "Content-Type=application/json" -X POST
> http://whatever/codebluebig/_all_docs?include_docs=true
> >
> > and still resulted in:
> >
> > {"error":"bad_request","reason":"invalid UTF-8 JSON"}
> >
> > Any other thoughts?
> >
>
>
> "=" != ":" (in your header declaration)
>
Re: Fetch multiple Documents with a single request
Posted by Benoit Chesneau <bc...@gmail.com>.
On Thu, Oct 14, 2010 at 11:29 AM, Peter Frisch <pe...@vervis.de> wrote:
> My next attempts looked like this:
>
> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82", "1284,133491,420777@default"]}' -H 'Content-Type=application/json' -X POST http://whatever/codebluebig/_all_docs?include_docs=true
>
> and
>
> curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82", "1284,133491,420777@default"]}' -H "Content-Type=application/json" -X POST http://whatever/codebluebig/_all_docs?include_docs=true
>
> and still resulted in:
>
> {"error":"bad_request","reason":"invalid UTF-8 JSON"}
>
> Any other thoughts?
>
"=" != ":" (in your header declaration)
RE: Fetch multiple Documents with a single request
Posted by Peter Frisch <pe...@vervis.de>.
My next attempts looked like this:
curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82", "1284,133491,420777@default"]}' -H 'Content-Type=application/json' -X POST http://whatever/codebluebig/_all_docs?include_docs=true
and
curl -d '{"keys":["fbd2b4d65d5d06d185ec7957abffed82", "1284,133491,420777@default"]}' -H "Content-Type=application/json" -X POST http://whatever/codebluebig/_all_docs?include_docs=true
and still resulted in:
{"error":"bad_request","reason":"invalid UTF-8 JSON"}
Any other thoughts?
-----Original Message-----
From: Benoit Chesneau [mailto:bchesneau@gmail.com]
Sent: Donnerstag, 14. Oktober 2010 11:01
To: user@couchdb.apache.org
Subject: Re: Fetch multiple Documents with a single request
On Thu, Oct 14, 2010 at 10:54 AM, Peter Frisch <pe...@vervis.de> wrote:
> I was very happy to find the apache wiki page about fetching bulk documents with one request. Unfortunately I always receive a error message claiming that my request was no valid JSON. After staring at my request for half an hour I still can't find a malformed JSON there:
>
> curl -d '{"keys":["1-7987539b0f7c047728dbd21b16fe442e"]}' -X POST http://whatever/codebluebig/_all_docs
>
> Has anyone an idea what the problem might be?
>
-H "Content-Type: application/json" is missing.
- benoît
Re: Fetch multiple Documents with a single request
Posted by Benoit Chesneau <bc...@gmail.com>.
On Thu, Oct 14, 2010 at 10:54 AM, Peter Frisch <pe...@vervis.de> wrote:
> I was very happy to find the apache wiki page about fetching bulk documents with one request. Unfortunately I always receive a error message claiming that my request was no valid JSON. After staring at my request for half an hour I still can't find a malformed JSON there:
>
> curl -d '{"keys":["1-7987539b0f7c047728dbd21b16fe442e"]}' -X POST http://whatever/codebluebig/_all_docs
>
> Has anyone an idea what the problem might be?
>
-H "Content-Type: application/json" is missing.
- benoît