couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject Re: encoding startkey and endkey in GET request
Date Tue, 02 Mar 2010 09:57:26 GMT
On Tue, Mar 02, 2010 at 02:22:59PM +0530, Manokaran K wrote:
> I cannot figure out how to encode complex keys in the url - especially when
> numbers are involved. How does futon do it?

1. encode them into JSON
2. URL encode the JSON string

e.g. a plain string:    startkey=%22foo%22

a string in array:      startkey=%5B%22foo%22%5D

[123,456]:              startkey=%5B123%2C456%5D

The encoding rules are in RFC 3986. Basically you must encode all "reserved"
characters - which includes square brackets and comma.  Double-quote is not
listed either as "reserved" or "unreserved", so it's up to you.

Your HTTP client library may have tools for doing the URL-encoding for you.

Mime
View raw message