Wufoo API Contest Entry: YQL Tables
[GEEK ALERT: I'm hijacking my old personal blog as a place to drop some info about a web coding contest I entered]
This one falls under the category of “wrapper.” I’ll keep it short. If you’re not familiar with YQL, go read all about it. But the Wufoo API is fantastic; RESTful, well-documented, and fairly flexible. So why bother going through YQL? A few reasons, all of which have to do with efficiency:
Speedy Server
If you’re making one single simple call to the Wufoo API, it’s going to be tough to beat just hitting it directly. But if you need to make multiple calls, filter, sort, etc. then you can take advantage of Yahoo!’s server farm. YQL let’s you run server-side Javascript. No strings attached. Heck you don’t even need an account. Chances are the PHP running on your discount shared hosting account won’t quite match what Yahoo! has running on their farm.
Caching
YQL implements some decent caching. That means you’ll be less likely to hammer the Wufoo servers for identical calls, and also keep it more likely that you won’t go over your 5000 call limit. That’s good for your users, you, Wufoo, and the internets.
Combine Queries
Whether pulling from two different sources or just running a subselect within the Wufoo API, YQL can do all that combining in the background, and you can just send one single query. For example, in this call we’ll grab the EntryIds of any entries that match “Ryan,” and then use that to fetch the comments.
NOTE: In all of the examples below, click the blue “TEST” button to see them in action in the web console
Wufoo comments based on Entry search
Or maybe you want all the entries and comments for a form. Two separate calls? bleh. Let’s batch that:
Again, all that parsing and subsequent calling is happening on the YQL servers.
But where it really gets interesting is when we combine totally disparate data sources. Like how about getting the geo coordinates from the IP address of a Wufoo entry? Again, one single call does it all:
Get location based on Wufoo Entry IP address
Yep, true to their word it looks like at least part of the Wufoo team is hanging out down there in sunny Florida.
Filter
The Wufoo API already lets you limit entries by searching for specific values, and also by setting the “page size.” What it doesn’t allow is a way to specify which fields get returned. If you’ve got a form with lots of text in the entries, pulling 50 full entries down is a real drag if you don’t need all those fields. This example won’t be too dramatic given the tiny bit of text and only 4 entries, but you’ll get the idea:
Select only First Name and Date Created
List of tables
- Forms
- Fields
- Entries
- Comments
- Login
These should be pulled from GitHub into the main set of community tables by the YQL team within a few days. In the meantime, you can either put something like this at the beginning of your query: USE http://static.limechile.com/wufoo.entries.xml as wufoo.entries or add &env=http://static.limechile.com/wufoo.env at the end, depending on your style.
Beyond the contest
YQL also allows you to INSERT, DELETE, and UPDATE. Someday if the Wufoo API gets more of those added, I’ll probably update these tables.

