The Itunes API is very nice. You can find details on it at ITunes API

I thought I may as well add an Apps Script wrapper library to it, since it can provide a wealth of test data to play around with, and it may be useful to some.

Set up

The API is open and public, so no need for API keys or anything.

Getting a instance of ITunesAPI

You’ll need the cITunesAPI library (or you can get in from github)


Then you can do this

I’ve implemented two kinds of retrieval methods

  • Lookup – you can get specific itunes entries given some of the various itunes IDS
  • earch – you can do a text search to return entries


The are many parameters, documented in the itunes api page, so I’ll show a selection of examples here to see how you can invoke them with the Apps Script library. The format of the results object is the same as I use for many of the libraries, and looks like this

so check result.success, and if all is well you can use

All of these lookups can take multiple ids. Just specifify them in a list

Any API parameters can be added to an array as the second argument to the lookup method. Dont encode them – the library will take care of that.

The searchTerm method takes a simple text search, in addition to any of the API optional parameters

The default limit on searches is 50, and the maximum is 200. There is no way of pagination if you need to get back more

Here’s an example of the results

If you want to dump that to a sheet, you may not want all of it. Here’s a handy pattern to selectively write out some fields

Which gives you something like this.

and that’s all folks..
For more like this see Google Apps Scripts Snippets
Why not join our forum, follow the blog or follow me on Twitter to ensure you get updates when they are available.