Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field(s) parameter #17

Open
Graham42 opened this issue Dec 19, 2013 · 2 comments
Open

Field(s) parameter #17

Graham42 opened this issue Dec 19, 2013 · 2 comments

Comments

@Graham42
Copy link
Contributor

The FieldLimiter should take the field parameter as a list like ?fields=fieldA,fieldB,fieldC and not ?field=fieldA&field=fieldB&field=fieldC the way it currently does.

I will can work on this when I get chance.

@mystor
Copy link
Member

mystor commented Dec 19, 2013

I think that we can leave this for later. I see no reason why we can't use
this method until later when we can change to using a comma separated list.
If we built everything correctly we should only need to touch the field
limiter.
On 2013-12-19 3:18 PM, "Graham42" [email protected] wrote:

The FieldLimiter should take the field parameter as a list like
?fields=fieldA,fieldB,fieldC and not
?field=fieldA&field=fieldB&field=fieldC the way it currently does.

I will can work on this when I get chance.


Reply to this email directly or view it on GitHubhttps://github.com//issues/17
.

@uniphil
Copy link
Member

uniphil commented Dec 19, 2013

We should accept both, but I think the current ?key=val1&key=val2 is more important.

So my understanding is that there's no standard to guide us here, just conventions.

?key=val1&key=val2

This is how web browsers encode values for a multi-select list, and it seems to be widely supported. Werkzeug has built-in support for for this. (side-note: wikipedia claims that servers should accept semicolons instead of spaces, but werkzeug doesn't seem to) jQuery also follows this convention when you try to serialize an array (http://api.jquery.com/jQuery.param/). Finally, python's built-in urllib.urlencode will also serialize lists this way (you have to pass doseq=1 or it just stringifies it).

I think this one is closer to a standard.

?key=val1,val2

There isn't a really standard convention here, but I think sticking to just a comma-delimited list is simple and obvious. Apigee cites some big apis, like facebook, linkedin, google, that do this or some close variation, and apigee recommends it.

It's also way nicer to type into a browser, and if you don't have a library at hand to serialize your array into a query, joining on , is pretty easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants