Today, we’re pleased to announce our new
orkut Java client library!
If you’ve ever wanted to write desktop or mobile apps for
orkut, this open source Java library provides you with that opportunity. Using three-legged OAuth, you can get friends’ profile data, post and retrieve status and activity updates, read and write scraps, create and retrieve photo albums, and upload pictures. To get started, simply
download the library, check out the
included samples, and start coding.
With this library, it’s easy to have an application up and running with just a few lines of code. The snippet below shows how to create a photo album, share it with your friends, and upload photos:
CreateAlbumTx createAlbum = albumsFactory.createAlbum(
"College Days", "The best days of my life!");
Album album = createAlbum.getAlbum();
albumsFactory.shareAlbumWithFriends(album);
byte[] photo = captureImage();
photosFactory.uploadPhoto(album, photo, ImageType.JPG, "My Best Buddies");
And it’s just as simple to reply to scraps from friends and to make friends with new scrappers:
GetScrapsTx scraps = scrapFactory.getSelfScraps();
for(int i = 0; i < scraps.getScrapCount(); ++i) {
ScrapEntry scrap = scraps.getScrap(i);
if(myFriends.contains(scrap.getFromUserId())) {
scrapFactory.replyToScrap(scrap, "hey, thanks for remembering me!");
} else {
scrapFactory.replyToScrap(scrap, "wanna be friends? [:)]");
friendsFactory.sendFriendRequest(scrap.getFromUserId());
}
}
As you develop your application, we’d love if you’d
let us know what you create. We’re excited to see how you use this library to integrate orkut with other exciting products and technologies... and in fact, we already started! Take a look at our orkut
FotoScrapr app, which we built on
Google App Engine using a slick
Google Web Toolkit interface. If you like what you see, feel free to browse through the FotoScrapr
source code.
And finally, if you’re not a Java developer, don’t worry. We’d be thrilled to work with you to port this library to other languages. Just reach out to us on the
orkut developer forum.
So dive in and start coding – we can’t wait to see what you’re going to come up with!
By Prashant Tiwari and Sachin Shenoy, orkut team