So this is one of those stupid little development issues that eats up an hour of your time. I am documenting this in hopes that it will save someone from wasting an hour of your time.
I am learning couchdb and using curl to interact with it’s RESTful api. I wrote a view and was trying to limit it by a key. I was issuing the commands:
curl -X GET http://127.0.0.1:5984/blog/_design/posts/_view/by_author?key="rob"
I was getting a 500 error for invalid json. When I pasted the URL in the web browser I got a valid response. The problem was that you needed to escape the quotes on the curl call as %22 not “.
curl -X GET http://127.0.0.1:5984/blog/_design/posts/_view/by_author?key=%22rob%22
Keep in mind you only have to put the quotes around string values a not around numeric values.
Leave a Reply