O'Reilly logo

RubyMotion iOS Development Essentials by Abhishek Nalwaya, Akshat Paul

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Connecting to an external API

Right now we have hardcoded the object values, which usually never happens in a real-world application; let's get these values from an external API. For practicing purposes we have created an external API to get the data in JSON format.

If you visit http://restro.nalwaya.com/restaurants/search.json?city=Chicago or use the curl command instead, it will return the restaurants we have seeded for Chicago in JSON format (note that this is fictitious data, you might not actually find them in Chicago city).

Let's run the following curl command to get the data:

> curl "http://restro.nalwaya.com/restaurants/search.json?city=Chicago"
[{
  "name":"Polka Dots", 
    "thumb_url_image":"http://restro.nalwaya.com/system/
 restaurants/avatars/000/000/001/thumb/hotel.jpg?1352812187", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required