Get all docs api endpoint return Bad Request

curl -X GET "" -H "accept: application/json"

I call the api above and return doc -Cl1xFEbqiZWjstOYw-QfRr.


However, I call the api below and it returns Bad Request.

curl -X GET "" -H "accept: application/json"
{"error":"Bad Request","reason":"Bad keys"}

Keys must be an array.

Example : This request retrieves documents with Ids test1 and -test4.

curl -X GET \
  'http://localhost:4985/test_db/_all_docs?access=false&channels=false&include_docs=false&revs=false&update_seq=false&limit=5&keys=[%22test1%22,%22-test4%22]' \
  -H 'Accept: application/json' 

Any reason you are using the _all_docs API for fetch specific documents? The _all_docs is an expensive operation

Thanks, it works.

Maybe something wrong with the doc

Hi, I agree docs could be clearer on this. I have raised a ticket to resolve it

1 Like

Cool. And following up on my question -

I use it to debug whether the doc will be delivered to the correct channel or not.

In that case, I would suggest using _raw API. The all_docs is an expensive operation.