August 25, 2006
@ 12:25 AM

It looks like I'm now writing a Windows Live gadget every week. My latest gadget is a port of the Flickr badge to a Windows Live gadget. It's in the approval pipeline and should show up under the list of gadgets I've written in the next day or so. To get the gadget working, I had to use the Flickr API. Specifically, I used the flickr.people.findByUsername method to convert a username to an internal Flickr ID. Ironically Coincidentally, I had recently read something by Alex Bosworth criticizing this very aspect of the Flickr API in his post How To Provide A Web API where he wrote

Simple also means don’t be too abstract. Flickr for example chooses in its API to require the use of its internal ids for all API calls. This means for example that every call to find information about a user requires a call first to find the internal id of the user. Del.icio.us on the other hand just requires visible names, in fact internal ids are hidden everywhere.

Actually, it's much worse than this. It seems that Flickr is inconsistent in how it maps user names back to internal IDs. For example, take Mike Torres who has 'mtorres' as his Flickr ID. I can access his Flickr photos by going to http://flickr.com/photos/mtorres. When I use the Flickr API explorer for flickr.people.findByUsername and pass in 'mtorres' as the username I get back the following ID; 25553748@N00. When I go to http://flickr.com/photos/25553748@N00 I end up going to some other person's page who seems to be named 'mtorres' as well.

However when I plug "Mike Torres" into the flickr.people.findByUsername method instead of 'mtorres' I get '37996581086@N01' which turns out to be the right ID since going to http://www.flickr.com/photos/37996581086@N01 takes me to the same page as http://flickr.com/photos/mtorres. Weird.

Perhaps this is a naming collision caused by the merging of Flickr & Yahoo! IDs?


 

Friday, August 25, 2006 1:27:24 AM (GMT Daylight Time, UTC+01:00)
It's probably not a Yahoo collision.

It's to do with the distinction between permanent URL and username in Flickr.

They're not the same. Mike Tores username and real name are set to 'Mike Tores' but he has selected mtorres as the permanent identifier in his photo url.

Someone else has the actual username mtorres but they can't ever get the that as their url since it's already been snagged.

Not confusing in the slightest is it?
Friday, August 25, 2006 7:03:47 AM (GMT Daylight Time, UTC+01:00)
The only permenant name that's universally available on flickr is the ID that they use in the API. You can change your username so it would be a bad idea to use that name as a key. Not everyone has a personalized URI (e.g. http://flickr.com/photos/mtores), so that wouldn't work either.

The workings of the system would be more obvious if there were only one immutable ID, but the fact that there isn't is not the fault of the API.

For your gadget you'd want to use the username only during the initial setup. The Flickr ID should be the thing that you store, so the gadget doesn't break after a username change.

Having to update externally stored IDs after every name change, either manually or via a change notification API (augh!) does not qualify as "simple" in my book.

I had to argue this same point a few times when I was designing one of the internet facing APIs for Xbox Live.
Sunday, August 27, 2006 8:28:44 PM (GMT Daylight Time, UTC+01:00)
How does pointing out the flaws of Flickr help Microsoft products?
ninja tamer
Tuesday, August 29, 2006 6:47:51 AM (GMT Daylight Time, UTC+01:00)
>> How does pointing out the flaws of Flickr help Microsoft products?

Would you rather he tamed ninjas?
Anon
Comments are closed.