5

I am integrating RestKit with my project. I am using the version RestKit-0.20.2. Is there any way we can do the requests without object mapping in this version? I want to do the same thing the poster does here: Parsing JSON without Object Mapping in Restkit iOS. But it seems its a old version, and RKClient is not available in 0.20.2.

Is it possible to do request without object mapping using RestKit-0.20.2?

P.S.: I searched in Google and I could not be able to find/recognize the correct answer for my question as I am new to RestKit.

Thanks everyone!

Community
  • 1
  • 1
EmptyStack
  • 51,274
  • 23
  • 147
  • 178
  • 2
    Why not use the underlying AFNetworking classes? – Wain Jun 16 '13 at 22:00
  • Great. I think AFNetworking will help me. Thanks a lot. You would like to post this as an answer? Or do you think we should delete this post? Please let me know. Thanks. – EmptyStack Jul 06 '13 at 05:05
  • As there was a question about the previous version of RestKit too it seems reasonable that this one should stay here and have an actual answer. – Wain Jul 06 '13 at 05:54

2 Answers2

5

RestKit uses AFNetworking to perform all of its raw network communication and builds mapping on top. So, if you need to make requests without mapping you have full access to the AFNetworking classes to do so.

Wain
  • 118,658
  • 15
  • 128
  • 151
  • I want to do some code between mapping and response. I want mapping and network request both, but separately. Want to give response as input to Restkit for mapping. Any idea – Amit Battan Dec 12 '13 at 11:14
  • @AmitBattan, I don't understand you comment. You probably want to raise a question with full details. – Wain Dec 12 '13 at 12:36
  • 2
    You can get the `AFHTTPClient` inside the manager this way: RKObjectManager *manager = [RKObjectManager managerWithBaseURL:url]; AFHTTPClient* client = manager.HTTPClient; – Ferran Maylinch Feb 12 '14 at 00:49
2

I needed to send a PUT without object (and with Basic authorization). After trying different approaches, I finally sent the request using AFHTTPClient directly:

AFHTTPClient* client = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:@"http://the.host"]];
[client setAuthorizationHeaderWithUsername:username password:password];
[client putPath:@"/api/resource" parameters:nil success:success failure:failure];
Ferran Maylinch
  • 10,919
  • 16
  • 85
  • 100