Two Great new services: Picasa and YouTube

Post date: Apr 03, 2012 3:59:51 PM

If you have ever tried to connect to a service not in the standard offering by Google Apps Script you know it will be a lot of work. First you need to figure out the urlFetchApp service, OAuth, XML parsing and then dive into the API docs to figure out what you can do. That's just too much work for most people and why should we all keep doing this over and over? Today I would like to announce two new services; Picasa Services and YouTube Service brought to you by Romain Vialard and yours truly.

They work like a JavaScript library where you install the service in your code and then call out methods like any other Apps Script service. Let's take a look at a few examples.

Say your application uses images from a Picasa album. With only a few lines of code you can easily retrieve the titles and urls of all the photos. Use this in the UiApp and you will be assembling awesome web apps in no time. Let me also take a second and point out that OAuth is built in. This means the first time you run your code you will be asked to grant access for your app and then you are ready to go. What a relief to not need to figure out all that code.

PICASA EXAMPLE

function photos() {

var album = PicasaApp.getAlbumById('5623554255222794561');

Logger.log('Album title: '+ album.getTitle());

var photos = album.getPhotos();

for (var i in photos){

Logger.log('Photo title: '+ photos[i].getTitle() + ' url: ' + photos[i].getUrl())

}

}

Maybe in your great app you would like to display the top rated YouTube for today in France. This need not be a chore, in fact, it's only one line of code.

YOUTUBE EXAMPLE

var videos = YouTubeApp.getStandardFeed('top_rated', {time: 'today', regionID: 'fr'});

Logger.log(videos[0].getTitle());

We will be bringing more methods to these services and access to many more services in the coming weeks. Please subscribe to this feed or circle James Ferreira in Google+.