Added basic support for array query parameters #61

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
3 participants
@stou

stou commented Dec 18, 2012

Example of how to specify:

{
"Name":"arrayParam",
"Type":"array",
"Description":"Array of values"
}

Example of resulting query string:

… ?param[0]=first-value&param[1]=second-value

stou added some commits Dec 18, 2012

Basic support for array query parameters
Example of how to specify:

{
  "Name":"arrayParam",
  "Type":"array",
  "Description":"Array of values"
}            

Example of resulting query string:

 … ?param[0]=first-value&param[1]=second-value
@stou

This comment has been minimized.

Show comment Hide comment
@stou

stou Dec 19, 2012

I have also added url encoding of URI placeholders to try to fix issue #61

stou commented Dec 19, 2012

I have also added url encoding of URI placeholders to try to fix issue #61

@mansilladev

This comment has been minimized.

Show comment Hide comment
@mansilladev

mansilladev Dec 21, 2012

Contributor

Thanks for the pull request. Could you provide a sample config in the public/data directory so that people know how to use this feature?

Contributor

mansilladev commented Dec 21, 2012

Thanks for the pull request. Could you provide a sample config in the public/data directory so that people know how to use this feature?

@mansilladev

This comment has been minimized.

Show comment Hide comment
@mansilladev

mansilladev Jan 2, 2013

Contributor

Rasmus, I've sparked a discussion over on Google+ about passing arrays in the query string.

https://plus.google.com/117717178917897844920/posts/ZCLLVZb3w7x

I was wondering if you could chime in here (or there on G+). Does your API also accept the following as an unordered array?

http://foo.bar/resource/method?name=neil&name=rasmus

I'd like us to consider covering different permutations of array passing that are out there when an API call is instantiated in I/O Docs. So, the I/O Docs multi-value array interface is the same, however, when a call is made, it could be sent as one of the following (depending on a new array request attribute):

  • ?name=neil&name=rasmus
  • ?name[0]=neil&name[1]=rasmus
  • ?name=neil,rasmus
Contributor

mansilladev commented Jan 2, 2013

Rasmus, I've sparked a discussion over on Google+ about passing arrays in the query string.

https://plus.google.com/117717178917897844920/posts/ZCLLVZb3w7x

I was wondering if you could chime in here (or there on G+). Does your API also accept the following as an unordered array?

http://foo.bar/resource/method?name=neil&name=rasmus

I'd like us to consider covering different permutations of array passing that are out there when an API call is instantiated in I/O Docs. So, the I/O Docs multi-value array interface is the same, however, when a call is made, it could be sent as one of the following (depending on a new array request attribute):

  • ?name=neil&name=rasmus
  • ?name[0]=neil&name[1]=rasmus
  • ?name=neil,rasmus
@stou

This comment has been minimized.

Show comment Hide comment
@stou

stou Jan 10, 2013

Hi Neil

My api can only currently handle ordered arrays.

All I just wanted to share the code I wrote in order to document my own api
so others might benefit, since I found the rest of iodocs helpfull for me.
Whether you want to use my implementation is of cause up to you to decide.

An you are most welcome to implement the other query string formats as you
see fit.

By the way the format ?name[0]=neil&name[1]=rasmus is generated by node.js
module qs
qs.stringify(params)

And it worked with my api luckily.

Best regards,

Rasmus

Rasmus Stougaard, Rørbækvej 8, 6000 Kolding
mob: +45 61677868, mail: rasmus.stougaard@gmail.com

On Wed, Jan 2, 2013 at 11:28 PM, Neil Mansilla notifications@github.comwrote:

Rasmus, I've sparked a discussion over on Google+ about passing arrays in
the query string.

https://plus.google.com/117717178917897844920/posts/ZCLLVZb3w7x

I was wondering if you could chime in here (or there on G+). Does your API
also accept the following as an unordered array?

http://foo.bar/resource/method?name=neil&name=rasmus

I'd like us to consider covering different permutations of array passing
that are out there when an API call is instantiated in I/O Docs. So, the
I/O Docs multi-value array interface is the same, however, when a call is
made, it could be sent as one of the following (depending on a new array
request attribute):

  • ?name=neil&name=rasmus

  • ?name[0]=neil&name[1]=rasmus

  • ?name=neil,rasmus


    Reply to this email directly or view it on GitHubhttps://github.com/mashery/iodocs/pull/61#issuecomment-11827320.

stou commented Jan 10, 2013

Hi Neil

My api can only currently handle ordered arrays.

All I just wanted to share the code I wrote in order to document my own api
so others might benefit, since I found the rest of iodocs helpfull for me.
Whether you want to use my implementation is of cause up to you to decide.

An you are most welcome to implement the other query string formats as you
see fit.

By the way the format ?name[0]=neil&name[1]=rasmus is generated by node.js
module qs
qs.stringify(params)

And it worked with my api luckily.

Best regards,

Rasmus

Rasmus Stougaard, Rørbækvej 8, 6000 Kolding
mob: +45 61677868, mail: rasmus.stougaard@gmail.com

On Wed, Jan 2, 2013 at 11:28 PM, Neil Mansilla notifications@github.comwrote:

Rasmus, I've sparked a discussion over on Google+ about passing arrays in
the query string.

https://plus.google.com/117717178917897844920/posts/ZCLLVZb3w7x

I was wondering if you could chime in here (or there on G+). Does your API
also accept the following as an unordered array?

http://foo.bar/resource/method?name=neil&name=rasmus

I'd like us to consider covering different permutations of array passing
that are out there when an API call is instantiated in I/O Docs. So, the
I/O Docs multi-value array interface is the same, however, when a call is
made, it could be sent as one of the following (depending on a new array
request attribute):

  • ?name=neil&name=rasmus

  • ?name[0]=neil&name[1]=rasmus

  • ?name=neil,rasmus


    Reply to this email directly or view it on GitHubhttps://github.com/mashery/iodocs/pull/61#issuecomment-11827320.

@phairow

This comment has been minimized.

Show comment Hide comment
@phairow

phairow Oct 9, 2014

Contributor

closing since this is old and cannot be merged as is. array parameters in querystring seem like a valid request and we need to find a solution that works for all serialization techniques.

Contributor

phairow commented Oct 9, 2014

closing since this is old and cannot be merged as is. array parameters in querystring seem like a valid request and we need to find a solution that works for all serialization techniques.

@phairow phairow closed this Oct 9, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment