iOS_User
iOS_User

Reputation: 1382

How do I access a REST API on the iPhone?

So I'm brand new to rest's API and have never used an API ever before. I'm ok with Objective-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.

Upvotes: 3

Views: 2077

Answers (3)

Blake Watters
Blake Watters

Reputation: 6617

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.

Upvotes: 1

Mirek Rusin
Mirek Rusin

Reputation: 19462

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).

Upvotes: 0

adam
adam

Reputation: 22587

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

Good framework!

Upvotes: 1

Related Questions