web services - Passing parameters to REST API calls from Objective-C -


calling rest web services simple enough - use native nsurlconnection class , delegate methods:

nsmutableurlrequest *request = [[nsmutableurlrequest alloc] initwithurl:[nsurl urlwithstring:@"webserviceurl"]];      [request sethttpmethod:@"get"];      nsurlconnection *connection = [[nsurlconnection alloc] initwithrequest:request delegate:self]; 

but how pass object parameters call? instance, if web service expects object userinfo { name:string, age:int}.

now call has 2 parameters - i'm thinking of possible cases might have pass many more in request.

what's right way this? i've heard of restkit , plan try soon, there way without third party libraries?

usually when doing add parameters url. that, add query string end of string used generate url.

if doing post add parameters request body. done converting parameters nsdata , calling sethttpbody: on request.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -