Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS RestKit parameters for query

I am trying to GET something from the server, using RestKit.

Let's say I have class A and I want to map returned data to objects, but and i need to append three parameters to request url, for example :

http://example.com/someobject/?param1=value1&param2=value2&param3=value3

I have been reading RestKit guide from Github on how to perform mapping of returned objects, seems easy enough, but I simply can't find anything on how to add parameters to the query, most stuff is about outdated 0.10.x library.

Can anyone explain the process?

EDIT:

I mean plain process without using RKClient, but rather RKObjectRequestOperation.

like image 226
foFox Avatar asked Feb 01 '13 15:02

foFox


1 Answers

It is very easy to use RKObjectManager in this instance since one can pass in an NSDictionary as the parameters argument.

NSDictionary *params = @{@"param1" : @"value1",
                         @"param2" : @"value2",
                         @"param3" : @"value3"};

[[RKObjectManager sharedManager] getObject:someObject path:nil parameters:params success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {

    // success

} failure:^(RKObjectRequestOperation *operation, NSError *error) {

    // failure

}]
like image 194
Alex Avatar answered Oct 11 '22 17:10

Alex