foFox
foFox

Reputation: 1124

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.

Upvotes: 5

Views: 2333

Answers (1)

Alex
Alex

Reputation: 8991

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

}]

Upvotes: 5

Related Questions