Multiple key/value pairs in HTTP POST where key is the same name

Posted by randombits on Stack Overflow See other posts from Stack Overflow or by randombits
Published on 2010-04-10T20:01:39Z Indexed on 2010/04/10 20:23 UTC
Read the original article Hit count: 298

I'm working on an API that accepts data from remote clients, some of which where the key in an HTTP POST almost functions as an array. In english what this means is say I have a resource on my server called "class". A class in this sense, is the type a student sits in and a teacher educates in. When the user submits an HTTP POST to create a new class for their application, a lot of the key value pairs look like:

student_name: Bob Smith
student_name: Jane Smith
student_name: Chris Smith

What's the best way to handle this on both the client side (let's say the client is cURL or ActiveResource, whatever..) and what's a decent way of handling this on the server-side if my server is a Ruby on Rails app? Need a way to allow for multiple keys with the same name and without any namespace clashing or loss of data.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby