开发者

How do I access a REST API on the iPhone?

开发者 https://www.devze.com 2022-12-28 10:51 出处:网络
So I\'m brand new to rest\'s API and have never used an API ever before. I\'m ok with Ob开发者_StackOverflowjective-C and Cocoa Touch but just have no clue where to start when accessing the API and ho

So I'm brand new to rest's API and have never used an API ever before. I'm ok with Ob开发者_StackOverflowjective-C and Cocoa Touch but just have no clue where to start when accessing the API and how to in general. Can someone help me get started with some code that will access titles in rest or just how to access a REST API in general with authentication. Thanks.


Try http://allseeing-i.com/ASIHTTPRequest/

Good framework!


Take a look at RestKit: http://restkit.org/

It features a high level object mapping framework that can turn remote RESTful responses back into local objects declaratively, handling all the parsing and mapping for you.


http://github.com/mirek/NSMutableDictionary-REST.framework is easy to use.

To get REST as dictionary from GitHub API as an example:

NSString *url = @"http://github.com/api/v2/xml/user/search/mirek";
[NSMutableDictionary dictionaryWithRESTContentsOfURL: url];

To post:

[myDict postRESTWithURL: @"http://localhost:3000/my-rest"];

It supports sync/async, intuitive array conversions, url encoded and multipart posts (you can send images and other files).

0

精彩评论

暂无评论...
验证码 换一张
取 消