I added Twitter support to Divvs yesterday. I had started it a while back, and then other things became more important, but since we’re getting Real Close to calling it “alpha” I figured I’d wrap it up.
I ran into an interesting snag with the Twitter API: it’s too clever.
I think Twitter assumes that most people using the API are writing clients of either a web or desktop variety. They also have a very strong need to limit how much data gets returned. So most of their API calls have paging, where you only get 100 records back, and have to pass in a page param to get the next set.
In our case, all I want is a list of the user’s friends and followers. I don’t need their status updates, details, pictures, or anything else.
I’d like to do something like this:
The problem is, I only get the first 100 in each call. I have to page through. Here’s what I ended up with:
This means that even for the best case, I’m doing 2 calls when 1 would suffice. Worst case, I’m doing 7, 10, 15 calls.
I’m not actually complaining about the Twitter API. They’ve optimized for their normal cases, and when I ask them about this I bet they’ll add something to turn my 15 calls into 1. (Even if they don’t, it’s not a big deal, since it works.)
It just reminds me that all too often, we assume we know what our users need. We don’t, though. They find new needs, and work around us when we get in the way.
Firstly, this comment box is super tiny. Secondly, embedding code as a gist is great for feedback (since I have a tiny textarea otherwise) but doesn’t show up in RSS at all.
First, I’ve found @al3x to be SUPER to deal with; the best API support I’ve ever experienced. Just post here: http://groups.google.com/group/twitter-development-talk/topics
Second, I think Twitter may be requiring you to chunk by 100 in order to optimize for HTTP caching. Also, think what a load it would put on Twitter if several apps attempted to download @Scobleizer’s friend list?
Anyway, I’m working on a Twitter app that I’d like to integrate with Divvs once we get close to our own alpha. If you are interested I’ll let you know more soon.
@Jamie: wow, that IS tiny…
@Mike: yep, al3x is awesome. And yes, I know why they’re doing it, and probably they made the right call for 90% of the cases. Not really a criticism of Twitter, as much as a thought on APIs in general. Would love to talk about your app…are you coming to Open Coffee?