From user-return-12494-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Tue Sep 07 18:13:57 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 64054 invoked from network); 7 Sep 2010 18:13:57 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Sep 2010 18:13:57 -0000 Received: (qmail 92600 invoked by uid 500); 7 Sep 2010 18:13:55 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 92497 invoked by uid 500); 7 Sep 2010 18:13:55 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 92489 invoked by uid 99); 7 Sep 2010 18:13:55 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 18:13:55 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of taras.puchko@gmail.com designates 209.85.213.52 as permitted sender) Received: from [209.85.213.52] (HELO mail-yw0-f52.google.com) (209.85.213.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 18:13:32 +0000 Received: by ywo32 with SMTP id 32so3183303ywo.11 for ; Tue, 07 Sep 2010 11:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=XCG3tx6d6+4Wc2CXpmLKjQ0DBRxH25gGKDPPzkBjrDE=; b=EwQKnwUcNtW+IKF/bpGUUa7VpIgqUjqmMDIdtRZomMR6irBUBK9kN8B2HZ7hG9NMoj 5ADFr0jsti7DzCLPAaypcPHS3Zs4/bad1RsEyHVTXYxwvLUAzQcTurku8oLZgOS0VbHN CaZP3wsjsUfRwZWD7kxy9YYlNxGJ7Lhoa0Tkk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=jrTVNoawpiaFDYaPmUwtFbs1dHcRuhFgSWbTjfBgniOtpyAOX6AZ5fs2I6ZMmuTTaY sc1GjkupcSAbN0hYchAf/ERV4abVuBroWvMOiD3+RPmzRZhnfzPKUUgWtFd12hT01/tl 2W62codnOmNgS6oS5oNx51oWGsVrii5YIja8g= MIME-Version: 1.0 Received: by 10.151.63.42 with SMTP id q42mr462160ybk.258.1283883190619; Tue, 07 Sep 2010 11:13:10 -0700 (PDT) Received: by 10.151.114.10 with HTTP; Tue, 7 Sep 2010 11:13:10 -0700 (PDT) In-Reply-To: References: Date: Tue, 7 Sep 2010 21:13:10 +0300 Message-ID: Subject: Re: Rewrite a URL segment into a parameter with JSON string encoding From: Taras Puchko To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org The docs [1] state that the key must be a proper URL encoded JSON value, so _view/by-tag?key=3Djava won't work, but _view/by-tag?key=3D"java" will. [1] http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options Cheers, Taras On Tue, Sep 7, 2010 at 8:18 PM, Benoit Chesneau wrote= : > > On Tue, Sep 7, 2010 at 5:56 AM, Taras Puchko wro= te: > > Hello, > > > > I'm trying to use a URL segment as a key for a view, like the following= : > > { > > =C2=A0"from": "/tags/:tagname", > > =C2=A0"to": "_view/by-tag", > > =C2=A0"query": {"key": ":tagname"} > > } > > > > The problem is that the key have to be JSON-encoded, which complicates = my > > API. Every client has to know how to JSON-encode strings. > > > > However, I have found a workaround. If I use arrays for my keys the > > following works: > > { > > =C2=A0"from": "/tags/:tagname", > > =C2=A0"to": "_view/by-tag", > > =C2=A0"query": {"key": [":tagname"]} > > } > > > > I'm wondering if there is a more efficient solution for this problem. > > > > Thanks, > > Taras > > > > The key doesn't need to be json encoded only url encoded. If not let me k= now. > > - benoit