ioszillow

Integrating with Zillow API


I need to integrate my app with the Zillow API to retrieve specific information for display.

I don't know anything about doing that, so I need some general information about how to go about this.


Solution

  • How you integrate an API into your app depends on what kind of API you're dealing with. If I'm not mistaken, Zillow's is a web-based API, so you're going to access it by making HTTP requests to certain URL's and including the parameters that the API requires. What you get back from such a request depends on the API in question, but typically it's some data in XML or JSON format.

    Example: The GetZestimate call is a HTTP query to http://www.zillow.com/webservice/GetZestimate.htm that includes the zws-id and zpid parameters. Read all about them here. In return, you get back quite a bit of information as an XML file, also described on the page I linked above.

    As for how to actually make such a call... well, there are a number of ways, and a full description is a lot more than I'm willing to write. You should start by reading about the URL Loading System that's provided as part of iOS. Even if you don't end up using Apple's API directly, you should still read about it so that you have a basic idea of what's going on. There are a number of third party frameworks that mostly try to simplify the process of making web requests; one very popular framework is ASIHTTPRequest, which continues to see a lot of use even though the author has stopped development. There are others that you can easily find with a little Googling, but the basic idea is the same in most cases -- you construct a request and send it, and then you get back some data.

    You'll also want to look into frameworks that'll help you make sense of the data once you get it. Again, iOS provides some solutions for parsing XML, but there are also third party frameworks that try to make the process easier. One such is TouchXML. For JSON, things are a little easier: you should really just use the NSJSONSerialization class provided by iOS.