Main concepts

Query format

All requests must be done on 4 different data collections : artist, album, song, and file.
Each collection accepts different methods to retrieve data.
The url format is the same for every query :

http://api.lazytune.com/VERSION/COLLECTION/METHOD/VALUE.FORMAT?key=APIKEY[&options=OPTIONS][&limit=LIMIT]

Where :
  • VERSION : the LazyTune's API version you wish to use, currently 1.0.
  • COLLECTION : the data collection you want to work on, must be one on these: 'artist', 'album', 'song', 'file'.
  • METHOD : the action you want to execute on the given data collection, for example 'search', or look for an 'id'.
  • VALUE : the argument's type depends on which METHOD you use, for example if the METHOD used is 'search' the value will be a character string.
  • FORMAT : the output format to represent returned data: for example XML or JSON
  • APIKEY : you must include your LazyTune API Key in every query done to our database, except for queries using 'file' collection.
  • OPTIONS : a comma separated list of options, depends on the working collection and the method used. For example : "options=mbid,pict"
  • LIMIT : the maximum number of results returned by the query

LazyTune IDs

All LazyTune IDs (ArtistID, AlbumID and SongID) are compounds of 6 alphanumerical characters, and are case-sensitive for example "8qGVGo".
An ID identifies exactly one entity, and IDs are the fastest way to access ressources on LazyTune data collections.

Output formats

Because we know that every language/project requires an adaptated output format, we implemented different formats to represent the data.
You can use the following structured formats when querying LazyTune's database :
  • XML : The most famous markup format
  • JSON : A lightweight and powerful text-based format, perfectly adaptated to AJAX based applications
  • YAML : Human readable text-based format
  • PHP : Serialized PHP associative arrays, it can be unserialized using built-in PHP functions
Data collections

You will find there the caracteristics of each data collection.

There are two different types of data collections :
  1. The collections 'artist', 'album', 'song' ; they accept queries and return structured information. To query these collections, you must add your API key.
  2. The data collection 'file'; this collection returns audio files and does not require your API Key.

Artist

The output fields returned for each query done on the artist data collection are :
  • name : The artist name (string)
  • albumnum : The number of albums on LazyTune (integer)
  • songnum : The number of songs on LazyTune (integer)
  • id : The artist id (LazyTune ArtistID)
  • permalink : A permanent link to this artist
The following fields can be optionnaly added :

MethodValueFormatOptionsDescription
searchStringType 1mbid, pictSearches for an artist name
nameStringType 1mbid, pictLooks for an artist, that exactly matches the given string and returns a single record.
mbidMusicBrainz ArtistIDType 1pictLooks for an artist that is identified by the given MusicBrainz ArtistID and returns a single record.
idLazyTune ArtistIDType 1mbid, pictLooks for an artist that is identified by the given LazyTune ArtistID and returns a single record.

For instance, if you want to find every artist that contains the name "pete" and get the results in XML, you will use :

http://api.lazytune.com/1.0/artist/search/pete.xml?key=APIKEY

Or, if you want to get the artist whose MusicBrainz ID is "65314b12-0e08-43fa-ba33-baaa7b874c15", and get the result in JSON, you will use :

http://api.lazytune.com/1.0/artist/mbid/65314b12-0e08-43fa-ba33-baaa7b874c15.json?key=APIKEY

Album

The output fields returned for each query done on the album data collection are :
  • name : The album name (string)
  • songnum : The number of songs on LazyTune (numeric)
  • id : The album id (LazyTune AlbumID)
  • permalink : A permanent link to this album
  • artist
The following fields can be optionnaly added :

MethodValueFormatOptionsDescription
searchStringType 1mbid, pict, asinSearches for an album name
nameStringType 1mbid, pict, asinLooks for an album, that exactly matches the given string and returns a single record.
artistLazyTune ArtistIDType 1mbid, pict, asinReturns all the albums of the given artist identified by its LazyTune ArtistID.
mbidMusicBrainz ReleaseIDType 1pict, asinLooks for an album that is identified by the given MusicBrainz ReleaseID and returns a single record.
asinASINType 1mbid, pictLooks for an album that is identified by the given Amazon Standard Identification Number (ASIN) and returns a single record.
idLazyTune AlbumIDType 1mbid, pict, asinLooks for an album that is identified by the given LazyTune AlbumID and returns a single record.

For instance, if you want to find every album released by the artist whose LazyTune ArtistID is "8qGVGo" and get the results in XML, you will use :

http://api.lazytune.com/1.0/album/artist/8qGVGo.xml?key=APIKEY

Or, if you want to get the albums that contains the word "black", and get the result in Serialized PHP, you will use :

http://api.lazytune.com/1.0/album/search/black.php?key=APIKEY

Song

The output fields returned for each query done on the song data collection are :
  • title : The song title (string)
  • duration : The track duration in seconds (numeric)
  • tracknum : The track number in the album (numeric)
  • permalink : A permanent link to this album
  • file : A link to an audio file associated with this song
  • id : The song id (LazyTune SongID)
  • artist
  • album
The following fields can be optionnaly added :
  • mbid : MusicBrainz TrackID
  • maxbr : The maximum bitrate of its associated files (numeric, in kbps)
  • filenum : The number of associated files of any format (numeric)
  • ytnum : The number of associated YouTube files (numeric)
  • uptime : The uptime mean of the associated files (float, in percent)

MethodValueFormatOptionsDescription
searchStringType 1mbid, maxbr, filenum, uptimeSearches for a track name using title, artist and album strings.
titleStringType 1mbid, maxbr, filenum, uptimeLooks for a track using album title exclusively.
artistLazyTune ArtistIDType 1mbid, maxbr, filenum, uptimeReturns all the songs of the given artist identified by its LazyTune ArtistID.
albumLazyTune AlbumIDType 1mbid, maxbr, filenum, uptimeReturns all the songs of the given album identified by its LazyTune AlbumID.
mbidMusicBrainz TrackIDType 1maxbr, filenum, uptimeLooks for a track that is identified by the given MusicBrainz TrackID and returns a single record.
idLazyTune SongIDType 1mbid, maxbr, filenum, uptimeLooks for a song that is identified by the given LazyTune SongID and returns a single record.

For instance, if you want to find every song of the album whose AlbumID is "8qGVGo" and get the results in XML, you will use :

http://api.lazytune.com/1.0/song/album/8qGVGo.xml?key=APIKEY

Or, if you want to get the songs that contains the word "yesterday", and get the result in YAML, you will use :

http://api.lazytune.com/1.0/song/search/yesterday.yaml?key=APIKEY

File

This data collection differs from the other collections in two big points :
  1. You don't have to add your API key to the queries
  2. You will no get structured information but a HTTP redirection to a file of one of our supported file formats, an XML error might be returned if an error occurs.
The power of the LazyTune Search Engine comes from the ability to associate several files to the same song, so that if a file is no more available, you can access another associated file, or if a song has no more associated files, you may access it later if the LazyTune Engine associates a new file.
We also do daily availability checks, to allow the best Quality Of Service.
Indeed, each query done on the file data collection, redirects to the right file using a HTTP code 302, so that you can directly use this URL in a client-side application that supports HTTP redirections (a flash player for example).

Here are the supported formats :
FormatExtension
MPEG-1/2 Audio Layer 3.mp3
YouTube video clip.yt

The options help you to choose the file that will suit your needs, you can choose the file with the lowest bitrate if you don't want to waste too much bandwidth using the option lowbr, or choose the file with the best frequency using the option hifreq for example. If you want to get the file with the best uptime you can use the option uptime.
By default, the file with the highest uptime is returned.

MethodValueFormatOptionsDescription
songLazyTune SongIDType 2highbr, lowbr, hifreq, lowfreq, uptimeRedirects to an audio file associated with the given LazyTune SongID

For instance, if you want to get redirected to a mp3 file associated to the song whose LazyTune SongID is "8qGVGo", just use :

http://api.lazytune.com/1.0/file/song/8qGVGo.mp3

Or, if you want to get a file from the same song but with the lowest bitrate :

http://api.lazytune.com/1.0/song/song/8qGVGo.mp3?options=lowbr

You may also want to get redirected to a YouTube API video associated to the song whose LazyTune SongID is "qzSTN6", just use :

http://api.lazytune.com/1.0/file/song/qzSTN6.yt

If you want to use advanced YouTube player parameters you can pass your own arguments through our API.
For example if you would like to have a customized YouTube player you can use :

http://api.lazytune.com/1.0/file/song/qzSTN6.yt?options=api&color1=0x2b405b&color2=0x6b8ab6

Or if you plan to use the YouTube JavaScript API you will build an url like :

http://api.lazytune.com/1.0/file/song/qzSTN6.yt?options=api&enablejsapi=1

You will find here a complete description of the YouTube API.