Make your own Zillow Mortgage widget using ASP.net & C#
The last time I posted on Geek Estate, I wrote about how to use the Trulia API from a PHP page. Since watching mortgage rates fall is a lot more fun than watching home prices fall, I decided to implement a simple widget that uses the recently released Zillow Mortgage API. This time, I’m using Microsoft’s ASP.net framework instead of PHP (mainly because it’s the platform I program in professionally, I just dabble in PHP for fun). Anyway, ASP.net is a free web application development platform that comes with Windows and there are many web hosting companies that offer inexpensive ASP.net hosting plans.
If you don’t have a geeky disposition, you could take the easy way out and just use one of the “pre-built” Zillow built mortgage rate widgets. Of course, if you did that, you’d be missing out on the ability to change the layout, performance, appearance of your widget to your precise & exacting specifications. Maybe you want to use your brand’s colors instead of Zillow’s on your mortgage rate widget? Maybe you want your mortgage rate widget to display colored up or down arrows? Maybe your clients don’t speak English, and you need mortgage rates displayed in the language your clients speak more fluently (French, Spanish, Chinese, etc)? Maybe you want to implement it as an IE 8 Web Slice – so visitors can subscribe to your mortgage rate widget? Maybe the economy has you considering a career in software development? Anyway, I’m just saying there are many reasons why somebody would go through the trouble of writing their own widget.
In order to use the Zillow API, you need to get a Zillow Web Services ID (a/k/a ZWSID) for your application. After you have your ZWSID, you can call Zillow’s Web Services from your web applications, and start integrating the data they return into your web site. Anyway, here’s what my mortgage rate widget looks like. Creating a widget isn’t difficult. The toughest part is getting the data from Zillow’s Web Services into your web page. I’ve uploaded the ASP.net / C# source code for my Zillow Mortgage Rate widget, so you can go straight to the fun parts. If you look at the GetRateSummary function in my ZillowDemoPage class (it’s in the Zillow.aspx.cs file inside of the uploaded zip file), you’ll see how I got the data from Zillow’s Mortgage Rate Summary API.
Today’s |
Last |
||
30 Year Fixed |
5.16% |
▼5.26% |
|
15 Year Fixed |
4.74% |
▼4.84% |
|
5.1 ARM |
4.47% |
▼4.51% |
See more mortgage rates at Zillow.
Before you use this code on your web site, you’ll need to replace the zwsid variable with your Zillow Web Services ID (a/k/a ZWSID) key. Essentially, the code makes an HTTP request to Zillow’s GetMonthlyPayments web service, it creates an XML document from the response, and then I use a few XPath expressions to get the data out of the XML document that Zillow returns. After we get the data from Zillow’s Web Service, I place the result in a MortgageRates object and determine whether rates are going up or down. Then the ASP.net view engine uses the data in the MortgageRates object in the Zillow.aspx page, and essentially does a search & a replace with certain markup in that file with values in the MortgageRates object, until it generates the final result you see above.
I have a few helper functions that help me determine if rates are going up or down, and help draw the up and down arrows in the right colors, but it’s pretty easy compared to making the web service call. If you are an alpha geek, you may wonder why I’m using CSS classes which I didn’t define (e.g. hslice, entry-title, entry-content, ttl, etc) inside of my widget. Well, this particular widget uses a new IE 8 feature called Web Slices, (which is similar in spirit to the Web Clip feature in Mac Safari). This way my sites visitors can subscribe to the mortgage rate widget in IE 8, and can get updated rates sent right to my browser toolbar without even going to the site. Anyway, the Zillow APIs are free to use and the only requirement besides getting a ZWSID key, is having your widget meet their branding requirements.
This essentially the code I used for developing the mortgage rate widget on Real Property Associates web site. The one I developed for RPA, caches mortgage rate quotes for 10 minutes, so I don’t waste web server resources (both mine & Zillow’s) by asking for mortgage quotes on every page load, and the Zillow branding at the bottom matches their web site’s color scheme better. Aside from that, it’s pretty much the same. Happy coding!
David G from Zillow.com
Posted at 13:21h, 08 MarchVery cool tutorial Robbie – the widget looks great. The web slice feature is a nice touch for someone monitoring rates.
This is a good time to mention that Zillow’s other Mortgage API gives mortgage payments estimates based on current rates. It’s great content for an IDX site – you can display mortgage payment estimates on every listing.
Live Mortgage Rates via Zillow Mortgage API’s | Zillow Blog
Posted at 21:11h, 11 March[…] Search ResultsSEO and PPC for Traffic – But There’s More“Death of the Old School Realtor”Make your own Zillow Mortgage widget using ASP.net & C#How to Identify a “nofollow” LinkERA Re-Launches Their WebsiteLike a Heat Seeking Missle for an […]
Robbie
Posted at 23:57h, 19 MarchI implemented the Web Slice feature because I knew I was going to refi soon, and I wanted a quick way to answer the “Is it time to refi yet?” question.
betina
Posted at 11:00h, 27 OctoberPHP Platform is much better according to me . ASP need high requirements high priority in hardware than PHP . What is the latest price of mortage API ? Clear me please
mortgage_rates
Posted at 02:19h, 20 NovemberThis is so interested! Where can I find more like this?
Mark
Posted at 06:24h, 19 MarchGood piece. I wonder why i am just discovering this site.
Mark
Posted at 13:24h, 19 MarchGood piece. I wonder why i am just discovering this site.
cookbooks
Posted at 06:16h, 03 JanuaryYour website arrived up in my search i am in awe of what you have published on this subject. I am presently extending my investigation and thus can’t contribute further, notwithstanding, I’ve bookmarked your web site and you’ll be returning to keep up with any approaching revisions. Simply love it and thank you for tolerating my comment.
dieta personalizata
Posted at 07:29h, 03 JanuaryI have been looking the Internet for such information and i wanted to say thanks to u for this post. BTW, just off topic, where can i download a copy of this theme? – Regards