Search code examples
iosrestrestkit

RestKit 0.20 -- Multiple query parameters with same name?


I have an iOS application making use of RestKit 0.20-rc1 for RESTful services. I'm trying to perform a GET whereby I am providing multiple query parameters with the same name to retrieve a set of objects of the same type. For example, my URL would look like:

http://mysite.com/rest/myobjects?objID=123&objID=234&objID=345

My web service is able to accept a query like this and return the appropriate objects. My RestKit code on the client looks something like this:

NSDictionary *params = ...
RKObjectManager *objMgr = [RKObjectManager sharedManager];
[objMgr getObjectsAtPath:@"/rest/myobjects" parameters:params success:nil failure:nil];

My problem, is that the parameters must be specified as an NSDictionary, and I have multiple parameters with the same name. I tried setting the value in the NSDictionary to an NSArray containing all of the parameter values, but that did not work.

How do I specify multiple query parameters with the same name in RestKit using this methodology? Is this just not supported in RestKit?


Solution

  • Sounds like it is not going to be possible with the RestKit code you have. You may either:

    1. Change the code to allow NSArrays. RestKit is open source at https://github.com/RestKit
    2. Ask on the RestKit google group to see how others have worked around this. https://groups.google.com/forum/?fromgroups#!forum/restkit
    3. Submit a patch to RestKit and wait for a release that supports what you are asking for.