My favorites | Sign in
Logo
                
Search
for
Updated May 18, 2009 by off...@tunesbag.com
Labels: Featured, API, documentation
ApiDocumentation  
The official tunesBag API documentation v1

tunesBag.com REST API v 0.5 May 09

The tunesBag API enables developers interact with the tunesBag web site programmatically via simple HTTP REST requests. Please note that the API - as well as tunesBag - is still in beta, so some stuff here might change.

Other important documents / links

Core concepts, objects and dependences

Application That your program - you can use any system that supports HTTP requests / XML handling to talk to our API.
User The user object is on top of all items and represents an individual user of tunesBag.
Library The library is a collection of items, each item belongs to a single library. There always exist a default library for each user which is always used in case no library parameter is provided. One user can have multiple libraries.
Item The item is the meta information about the media item, currently music only. The item belongs to one single library.
Set A set is a collection of multiple items, e.g. a playlist. The playlist belongs to a single library and can contain multiple items from multiple libraries.

Authentification: The secure concept of remoteKeys

Almost every request requires an authentification. Requests to some public sources just need to contain the application key, certain RSS feeds can be queries without any further authentification. For details, see the description of the functions. If nothing special is stated, the default authentification schema applies.

The user needs to confirm the access by your application

The user needs to confirm that an application access his user data – this done by requesting a remote key by the application from the user.

To request the remote key, direct the user to this URL: www.tunesBag.com/rd/api/requestremotekey/?appkey=%yourApplicationKey%

The user will be redirected to a page where he can copy the remote key for your application and enter it in your application.
An application key can be requested for free at the tunesBag Developer section of our homepage (link is on top).

Request formats: POST / GET

For nearly all supports, we support both the GET and POST method, so you're free to use whatever you want. We recommend POST (like submitting a form) because of a better support for longer data, however. In case you’re uploading data (/items/add), you have to use POST and set the correct content-type “multipart/form-data” when sending data to the tunesBag API.

For all requests, an UTF-8 encoding is recommended and expected. In case you're using GET operators, make sure the parameters are URLEncoded as well. An example for a GET request:

http://www.tunesBag.com/api/rest/items/rate?appkey=[APPKEY]&username=[USER]&remotekey=[REMOTEKEY]&entrykey=B6E1FEC1%2DDDAD%2DE921%2D3F566FE2548E96F5&type=0&rating=80

An example for POST (shown as simple form request)

	<form action="http://www.tunesBag.com/api/rest/items/rate" method="post">
	<input type="text" name="appkey" value="[APPKEY]" />
	<input type="text" name="username" value="[USER]" />
	<input type="text" name="remotekey" value="[REMOTEKEY]" />	
    <input type="text" name="entrykey" value="B6E1FEC1-DDAD-E921-3F566FE2548E96F5" />
	<input type="text" name="type" value="0" />
	<input type="text" name="rating" value="80" />
	<input type="submit" />
	</form>		

Mandatory elements for each request

You have to provide the following elements for each request (either as URL/GET or as FORM/POST parameter):

appkey  string  the application key
 username  string  the username of the user you take the action behalf of
 remotekey  string the remote key (see security model)

Other mandatory elements are marked bold in this documentation, e.g.

param1 string  this is a mandatory parameter
param2  numeric  this one is optional

Privileged applications

Privileged applications can submit a field named Hashpassword with the MD5 hash of the password instead of the remotekey. This option is only available to privileged applications.

Return formats: XML / JSON

We support multiple data formats including XML, JSON and RSS. The default format is XML. RSS is only supported where it makes sense, e.g. reading the news feed.

You can set the desired return format using the parameter format, e.g.

http://www.tunesBag.com/api/rest/user/info/?format=JSON

Response elements

The response is always delivered as UTF-8 / Unicode.

Every response has four default items:

An example response (XML):

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>31AB8330-C4BE-E9DB-74BFE22B7A5F2D7B</requestkey>
<errormessage/><error>0</error>
<result>true</result>
</result>

An example response (JSON)

{"REQUESTKEY":"31ABEBC6-085B-0245-B0EDCB173464FD03","ERRORMESSAGE":"","ERROR":0.0,"RESULT":true} 
result boolean  Success? TRUE / FALSE
error integer  Error number (0 = OK, other response = error) List of error codes
 errormessage string error message
 requestkey string unique key used for logging your requests

Please note that 0.0 notation - this is a "feature" of our underlying Java Engine which handles all data as double.

Date format

All date / times are presented in the following form in XML:

YYYY-MM-DD HH:mm:ss.0 2008-07-07 11:06:31.0

Using JSON the format is

Juli, 07 2008 11:12:13 MonthName, DayNumber Year Hours:Minutes:Seconds

Default URL path

The basic path for all operations is http://www.tunesBag.com/api/rest/

Available default fields

Some operations share a common return field structure.

Items

Name Type Description
userkey string Entrykey of the user owning this item
dt_created date Date of creation
album string Name of album
artist string Name of artist
name string Name of item
entrykey string Entrykey of item (UUID)
genre string
comments string Comments on this item (read from the audio file)
source string Source of this file (e.g. webupload etc)
yr string Year of song release
hashvalue string SHA-1 hash value of the web optimized file stored in the system
originalfilehashvalue string SHA-1 hashvalue of the original file added to the system
librarykey string Entrykey of library where this item belongs to
size numeric Size of items (bytes)
totaltime numeric Length in seconds
tracknumber numeric Track number
rating numeric Rating of file (0 = no rating, 100 = highest, step = 20)
lasttime date Last time listened to this track
times numeric Times listened to this track

Sets (Playlists)

Name Type Description
 name  string  Name of set
 description  string  Description
dt_created  date created
dt_lastmodified  date last modified of either playlist or playlist items
 dynamic  numeric  1 = yes, items are calculated (e.g. recently added); 0 = no
entrykey  string entrykey of plist
 itemsCount  numeric  if dynamic always 0, otherwise number of items
librarykey string  entrykey of library
userkey string  owner userkey
 weight  numeric  weight (responsible for sorting etc)
 public  numeric 1 = yes, display in public
 tags string  tags, separated by comma
imageset numeric  0 = no special image, 1 = /res/images/playlist_images/ last three cars of entrykey / entrykey + '.' + 48|120|300.jpg

Info Feed

Functions - Test functions

Name Type Description
action numeric Type of action
100 = Created / Updated a playlist
600 = Added a comment to an mediaitem
601 = Added a comment to a set
610 = Rated an item
620 = Become a fan of an artist
802 = Become friend with
804 = Become follower of
500 = Recommended an item
content string Verbal description
Content_link string Link to item
dt_created date Item created (UTC)
entrykey string Entrykey of feed item
objecttitle string Title of affected object
Linked_objectkey string Entrykey of affected object
createdbyuserkey string Created by user (entrykey)
param string Additional parameter, e.g. rating stars
createdbyusername string Created by user (username)

Send a test request: http://www.tunesBag.com/api/rest/test/ping/

Return a simple demo answer. Only the application key is needed.

Parameters

returnCode numeric Return code to return. Good to test error returns

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>31D10E6E-F48A-9A36-0CD26E798AB0DF03</requestkey><errormessage/><error>0</error><result>true</result>
</result> 

User - related functions

Simple access check: http://www.tunesBag.com/api/rest/user/checkaccess

Check the given login credentials. Simple dummy request to check username and remotekey.

Get user info: http://www.tunesBag.com/api/rest/user/info/

Returns information about a user. Parameters

 username string  Username

Important return values

lang_id string  language (two chars)
quota  numeric  information about quota
librarykey  string  the default library key of this user
firstname string  
 surname  string  
 entrykey  string  entrykey of this user
pic  string  path to image of user
city  string  city of user
countryisocode  string  country (two chars)
 sex  numeric  0 = male, 1 = female
online  numeric  1 = is currently online
 libraryitemscount  numeric  number of items in the library

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<lang_id>en</lang_id>
<quota_currentsize>8783872695</quota_currentsize>
<librarykey>EED59E76-BB46-6F35-AF22895AA7435654</librarykey>
<errormessage/>
<homepage>http://tunesBag.blogspot.com/</homepage>
<libraryitemscount>1487</libraryitemscount>
<error>0</error>
<sex>0</sex>
<countryisocode>AT</countryisocode>
<surname>Doe</surname>
<firstname>John</firstname>
<online>1</online>
<quota_maxsize>9221225472</quota_maxsize>
<city>Vienna</city>
<requestkey>31D59E76-BB46-6F35-AF22895AA7435654</requestkey>
<pic>/res/images/profile_images/joh/johndoe_big.jpg</pic>
<result>true
</result>

Get the news stream of the user: http://www.tunesBag.com/api/rest/user/feed

Read the public news stream of a certain user

Parameters

feedusername string Username for which you want the news items.
maxagedays integer Default = 30 days (max age of items)
 sincedate  integer only news newer than sincedate (format = yyyymmddhhnnss)
options  string various options - currently supported: includeownitems (will include items created by user)
 actions  string  list of actions to return

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>31D794A7-AA99-A6FC-F29E640C06D9BF0C</requestkey>
<errormessage/><error>0</error>
<items>
<item><action>500</action><affecteduserkey>CC88ECA1-F205-9A74-1C41F00931943663</affecteduserkey>
<content>free.music recommended SaReGaMa - SaReGaMa - Oh No, Babe (2007) to John Doe</content>
<content_link>http://www.tunesBag.com//item/8B9BDB1E-90F7-2F9C-4D64024FD8D368E0</content_link>
<createdbyuserkey>EEEE539-90E2-1D5F-8E9D17392106E782</createdbyuserkey>
<createdbyusername>free.music</createdbyusername>
<dt_created>2008-07-17 16:38:58.0</dt_created>
<entrykey>3175A607-B389-598D-0ABB5E30B5B048D6</entrykey>
<linked_objectkey>8B9BDB1E-90F7-2F9C-4D64024FD8D368E0</linked_objectkey>
<objecttitle>SaReGaMa - SaReGaMa - Oh No, Babe (2007)</objecttitle>
<param>funkymusic</param>
<pic/></item>
</items>
</result> 

Get all friends: http://www.tunesBag.com/api/rest/user/friends/

Return friends + followers.

Parameters None.

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>324F199D-D1F6-76FE-3971E6D399F23E61</requestkey>
<errormessage/><error>0</error>
<items>
<item>
<about_me/>
<accesslibrary>0</accesslibrary>
<accesslibrary_seen_from_friend>0</accesslibrary_seen_from_friend>
<city>New York</city>
<displayname>peterD</displayname>
<dt_created>2008-05-16 23:45:31.0</dt_created>
<entrykey>F3B1E2F6-C78F-09DB-3AC4399FD37922B2</entrykey>
<fb_uid/>
<firstname/>
<libraryitemscount>1254</libraryitemscount>
<librarykey>AB0652C1-B827-F7EF-2DBC7CA2CC9EE690</librarykey>
<music_preferences/>
<online>0</online>
<otheruserkey>AB065288-02E2-26A0-0CAC654B43A6DE33</otheruserkey>
<photourl>/res/images/nobody.png</photourl>
<playlistscount>14</playlistscount>
<surname/>
<taste/>
<userkey>2406ECA1-F205-9A74-1C41F00931943663</userkey>
</item>
</items>
<result>true</result>

</result> 

Item related functions

Get all items (filter / search): http://www.tunesBag.com/api/rest/items/get/

Get all / filtered data from the library

Parameters

librarykeys string Load items of given libraries / library. Leave empty to load the default library of the user. To load libraries of friends, get the friendlist and grab the librarykey from there
maxrows integer Maximal number of items to return (0 = return all items)
fields string Fields to return (default = empty = the most important fields including the entrykey )
filter_expression string Filter expression (see filter expression documentation below)
filter_entrykeys string  Simple filter for certain entrykeys – will only return results for the given keys (separated by comma)
orderBy string Order by ALBUM / ARTIST / RATING / NAME / CREATED / RECENTLYPLAYED
 options  string  options to pass to call ... supported = uniquetable

Response

Default error codes / Fields See on top
lastkey string that allows you to track data changes in this library (new lastkey = something has changed

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>326EBAB6-0743-9281-F125F3102BCD5D3F</requestkey><errormessage/><error>0</error>
<result>true</result>
<items>
<item><album/><artist>Massive Attack</artist><entrykey>C26F1244-DD23-7CFF-D734EA4BC84B8DAD</entrykey><name>Unfinished Sympathy (Paul Oakenfold RMX)</name><times>111</times></item>
<item><album>Down the Road</album><artist>Van Morrison</artist><entrykey>30F0DDFE-C12C-9EF7-7FCEC94F46C8662B</entrykey><name>Dancing in the Moonlight</name><times>87</times></item>
</items>
<lastkey>21504883-9B19-341A-2C5894F6D17ACED0</lastkey>
</result> 

Options

 uniquetable  Generate a structure holding the unique information about the given items, will reduce amount of data transferred

Get the last key for a library http://www.tunesBag.com/api/rest/items/library/lastkey

Check if there is the need to reload the whole library database Parameters

librarykeys string Check these libraries for changes. If empty, the lastkey for the library of the current user will be returned.

Response

XML:/libraries/items/item/ / lastkey  string  the current librarykey and lastkey of this library

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
	<requestkey>EB2F8605-0EEA-379B-025526C589F57B66</requestkey>
	<errormessage/>
	<error>0</error>
	<result>true</result>
	<items>
		<item>
			<lastkey>8A222615-CB42-0178-E6EA559BF0F198CF</lastkey>
			<librarykey>AAF74A83-E2E4-FF76-1DF249055D777322</librarykey>
		</item>
	</items>
</result> 

Add an item: http://www.tunesBag.com/api/rest/items/add/

Add a new media item to the library of the user. Make sure that the content – type is multipart/form-data for the proper upload of your data.

Parameters

librarykey string Add to a certain library of the user (Can be left empty to add to the default library)
file string File upload field
Type numeric File type (0 = audio (only type supported at the moment))
Content-Type string Content-type of media to add … currently supported:
audio/mpeg (mp3) MP3 (default)
 audio/x-ms-wma (wma) Windows Media file
 application/ogg (ogg) OGG
 audio/mp4 (mp4 m4a) MPEG-4 Audio (Apple default format)
NotifyUser boolean Notify user of new item by email?

Response

0 OK, item has been received and will be added soon
204 or 4005 File already exists in user library
420 or 4100 Quota exceeded
 430 or 4101  Invalid file

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>3268C59A-074B-BBE6-04D9240129166DF0</requestkey><errormessage/><error>0</error><result>true</result>
</result> 

Get the delivery link for an item: http://www.tunesBag.com/api/rest/items/get/deliver

Get all information needed for an item delivery. You can request a certain version of the file, e.g. optimized for low bandwidth circumstances. To get the meta information about the track, please use the items/get function with a filter for this entrykey.

Parameters

libraryKey string Load items of given librarykey, if empty or not available, default library of user will be used
entrykey string Entrykey of item
options string Various constants separated by comma
   LOGPLAYED – log track as played
   FORWARDTOPLAYURL – in case you want to directly be connected to the media delivery URL
 targetformat  string Requested format (will be converted server-side). Default = mp3, supported = mp3 / aac
targetbitrate integer When you leave this property at 0 (default) the original file will be delivered.
   Request the file with a certain bitrate – supported: 32 / 64 / 96
 preview  string  true/false (default=false) ... request a preview version

Response

Result, errormessage,  Default response fields
location string Location of the file (http URL, might be relative!).
 ContentType string  Content-Type (e.g. audio/mpeg)
ContentLength numeric   Length of content to expect (Can be -1 in case the content is generated on the fly)

Important notes In order to create a valid XML response, "&" - chars in the location are automatically converted to "&amp;". In case your preferred development tool does not automatically decode the correct URL, you've to do this conversion by yourself (e.g. if you're using PHP, use the function html_entity_decode).

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>3278EA33-9BA4-CB9B-1187ACEC79B1F564</requestkey><errormessage/>
<contentlength>-1</contentlength>
<error>0</error>
<contenttype>audio/mpeg</contenttype>
<location>/deliver/ticket/3278EAA5-E96A-CBB1-D8E323EC15938B6F/deliver.pl</location>
<result>true</result>
</result> 

Get a flash based player for an item: http://www.tunesBag.com/api/rest/items/get/deliver/player

Deliver some HTML code containing a flash player with the given track Parameters

libraryKey string Load items of given librarykey, if empty or not available, default library of user will be used
entrykey string Entrykey of item
bgcolor string background-color of the player (format: FFFFFF)
 autostart  boolean  autostart? TRUE or FALSE

Response

Result, errormessage,  Default response fields
content string HTML code to include in your page containing the flash player and scripts

Example HTML content

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>CEE93481-9C7E-C061-E8194DEF90CD32B8</requestkey>
<errormessage/>
<error>0</error>
<result>true</result>
<content>
&lt;script type="text/javascript" src="http://www.tunesBag.com/static/demos/swfobject.js"&gt;&lt;/script&gt;
&lt;div id="player_B7193D9FC274E1CEB9143A61800469D3"&gt;This text will be replaced&lt;/div&gt;
&lt;script type="text/javascript"&gt;
var so = new SWFObject('http://www.tunesBag.com/static/demos/player.swf','mpl','470','20','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('flashvars','&amp;type=mp3&amp;autostart=true&amp;file=http%3A%2F%2Fwww.tunesBag.com%3A8030%2Fapi%2Frest%2Fitems%2Fget%2Fdeliver%2F
%26entrykey%3DCCDDD3E9%252DD150%252DE743%252D07307638800B2B68%26appkey%CD83%252DF8D9%252D60D4%252D4572A1A21EFEE81E%26username%3Dfmyusername
%26remotekey%3Dabwerwerwerd%26options%3Dlogplayed%2CFORWARDTOPLAYURL');
so.write('player_B7193D9FC274E1CEB9143A61800469D3');

&lt;/script&gt;
</content>

</result> 

Check for file existence: http://www.tunesBag.com/api/rest/items/checkhashvalues

Submit hash values to the system and get back the answer if the given files already exist on the system or not. This must be a POST request with a file upload, don't forget to set the correct encoding type of the form.

Parameters

filedata File upload XML file with hashvalues to check for existence

Example file request (XML)

<?xml version="1.0" encoding="utf-8"?>
<items>
<item>
<hashvalue>1F21A33C219B8429AD56C6059B3D66CEAD8C8CA6</hashvalue>
</item>
<item>
<hashvalue>20527DEC18D656ECD98A8C077E13723FFF3BAD2A</hashvalue>
</item>
</items>

You have to compute the SHA-1 hashvalues in your application – we recommend you to cache these values in case you’re often using them because getting the hash value is a rather slow process. Example Response You will receive the status of the given hashvalues with the following codes

 200 File exists, no need to upload again
 204 Please upload the meta data only
 404 File does not yet exist, please upload

An example response (XML)

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>1766CAFA-0A1B-B0B5-7792AA4A499476DD</requestkey>
<errormessage/>
<error>0</error>
<items>
<item>
<hashvalue>1F21A33C219B8429AD56C6059B3D66CEAD8C8CA6</hashvalue>
<statuscode>404</statuscode>
</item>
<item>
<hashvalue>F99DC33C219B8429AD56C6059B3D66CEAD8C8CA6</hashvalue>
<statuscode>200</statuscode>
</item>
</items>

Rate an item: http://www.tunesBag.com/api/rest/items/rate/

Set rating of an item. Parameters

entrykey string Entrykey of item
 rating numeric 0 = no rating; 20, 40, 60, 80, 100 = to
comment  string  Add an additional comment? (max 250 chars, text only)

Example XML response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>327E34B4-0A41-54DD-B25B79659A92D5BD</requestkey><errormessage/><error>0</error><result>true</result>
</result> 

Set (playlist) tasks

List all playlists of an user: http://www.tunesBag.com/api/rest/sets/get/

List all personal playlists of an user.

Parameters

 options  string  various options, separated by comma

Options

notemporary  do not return temporary playlists
ownonly  only return own playlists
nodynamic  do not return dynamic (read only) playlists

This list contains several default playlists as well:

recentlyplayed Recently played
toprated  Top-rated items
followstream  What your friends are listening to
recommendations  Items recommended to you
recentlyadded  Added in the last few weeks

Example XML response Explanation of fields see on top.

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>32804F85-E657-4136-5BB9B9F1D4575E8A</requestkey>
<errormessage/><error>0</error>
<items>
<item>
	<description/>
	<dt_created/>
	<dynamic>1</dynamic>
	<dynamic_criteria/>
	<entrykey>recentlyplayed</entrykey>
	<istemporary>0</istemporary>
	<itemcount/>
	<items/>
	<librarykey>FBF74A83-E2E4-CA76-1DF249055DF7E322</librarykey>
	<name>Recently played</name>
	<public>0</public>
	<tags/>
	<userkey>EE44ECA1-F205-9A74-1C41F00931943663</userkey>
	<weight/>
</item>
<item>
	<description>Cool tracks from various genres</description>
	<dt_created>2008-02-18 10:17:57.0</dt_created>
	<dynamic>0</dynamic>
	<dynamic_criteria/>
	<entrykey>2BD5D822-A618-E127-A8D8736E59E7BBEE</entrykey>
	<istemporary>0</istemporary>
	<itemcount>0</itemcount>
	<items/>
	<librarykey>FBF74A83-E2E4-CA76-1DF249055DF7E322</librarykey>
	<name>Cool</name>
	<public>1</public>
	<tags>party cool  smooth</tags>
	<userkey>EE44ECA1-F205-9A74-1C41F00931943663</userkey>
	<weight/>
</item>
</result> 

Search for playlists http://tunesBag.com/api/rest/sets/search/

Search for playlists

Parameters

 search string search for artist, track name, plist name

Get all sets where the user has access to: http://www.tunesBag.com/api/rest/sets/get/allaccessible

Return meta information about accessible sets of a user – means playlist of the user or all playlists an user can access (including items of friends).

Get items of a playlist: http://www.tunesBag.com/api/rest/sets/set/getitems/

Get meta information about items of a set (will e.g. return the items of a playlist and information about the set itself)

Parameters

setkey string Entrykey of set
options string  various options (see list below)

Options

simplelist Return a simple list in //result/set/item/items/

Example respone Response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>329209C2-B0DC-C49C-0D92A6322B07F140</requestkey>
<errormessage/><error>0</error>
<result>true</result>
<set>
	<item>
	<description/>
	<dt_created>2008-07-12 18:14:05.0</dt_created>
	<dynamic>0</dynamic>
	<dynamic_criteria/>
	<entrykey>180CF072-9959-ED76-1434B3A0866F53CD</entrykey>
	<istemporary>0</istemporary>
	<itemcount>5</itemcount>
	<items>18293F28-DADB-FD0C-3627557A73D5A879,182DD035-04DA-C185-D55A26E65C67DE42,1832646E-A54A-B40D-337E91C15A897C71,
		1836F894-B3B9-47D0-E4C01CF07C9ED70A,1841805C-C8AB-5586-4590D320E7ED9D75</items>
	<librarykey>FBF74A83-E2E4-CA76-1DF249055DF7E322</librarykey>
	<name>Party-Jukebox</name>
	<public>0</public><tags/>
	<userkey>EEE6ECA1-F205-9A74-1C41F00931943663</userkey>
	<weight/>
	</item>
</set>
<items>
	<item>
		<album>Life is Sweet [Single]</album>
		<artist>Chemical Brothers</artist>
		<comments/>
		<dt_created>2008-07-12 18:45:02.0</dt_created>
		<entrykey>18293F28-DADB-FD0C-3627557A73D5A879</entrykey>
		<genre>Big Beats</genre>
		<lasttime>2008-07-17 14:45:35.0</lasttime>
		<librarykey>FBF74A83-E2E4-CA76-1DF249055DF7E322</librarykey>
		<name>Life is Sweet(Daft Punk Remix)</name>
		<rating/>
		<size>8119702</size>
		<source/><temporary>0</temporary>
		<times>7</times>
		<totaltime>508</totaltime>
		<tracknumber>2</tracknumber>
		<userkey>EEE6ECA1-F205-9A74-1C41F00931943663</userkey>
		<year>1995</year>
	</item>
	<item>
		<album>Chemical Four (Advance)</album>
		<artist>Chemical Brothers</artist>
		<comments/>
		<dt_created>2008-07-12 18:50:00.0</dt_created>
		<entrykey>182DD035-04DA-C185-D55A26E65C67DE42</entrykey>
		<genre>Big Beats</genre>
		<lasttime>2008-07-17 14:43:40.0</lasttime>
		<librarykey>FBF74A83-E2E4-CA76-1DF249055DF7E322</librarykey>
		<name>Star Guitar</name>
		<rating/><size>6201692</size>
		<source/><temporary>0</temporary>
		<times>5</times>
		<totaltime>388</totaltime>
		<tracknumber>4</tracknumber>
		<userkey>EEE6ECA1-F205-9A74-1C41F00931943663</userkey>
		<year>2002</year>
	</item>
</items>

</result> 

Add items to a playlist: http://www.tunesBag.com/api/rest/set/additems/

Add items to the given playlist / set. Parameters

 setkey string  Entrykey of set
 itemkeys  string  List of item entrykeys to add to the set
 options  string various options, separated by comma

Options clearplaylist = Clear playlist items before adding new items

Response Default response codes

Create/Edit a playlist: http://www.tunesBag.com/api/rest/set/save/

Create or edit a playlist Parameters

setkey string  Entrykey of set (Leave empty to create a new playlist)
name string Name of the list
 description String
tags string Tags separated by spaces
 public numeric 0 / 1

Response Default response codes entrykey in case it worked.

Social features

Share an item: http://www.tunesBag.com/api/rest/social/share/

Share an item with other people

Parameters

 itemtype numeric  type of item (see below)
identifier string entrykey/identifier of the item
recipients  string comma separated list of recipients, either email addresses or tunesBag usernames with prefix mailto: or user:
 comment  string  Comment to add

Recipients examples

We're currently supporting the following prefixes: mailto: (e-mail) and user: (local user) Separate multiple recipients by comma.

mailto:user@domain.com,user:myfriend
user:peter77
mailto:office@salzamt.at

Item types

1  Track
2  Playlist
3  Album
4  Artist
5 User
 6 Event

Response Default response codes entrykey in case it worked.

Get list of shared items: http://www.tunesBag.com/api/rest/social/share/list/

Returns the list of recommended items by this user PLUS items recommended to this user

Parameters

|| list
filter_type string list of types to return (e.g. only track and playlist recommendations)
direction string

Response

Default response code  see above
 //items/item/ structure information about shared items

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>EED794A7-AA99-A6FC-F29E640C06D9BF0C</requestkey>
<errormessage/>
<error>0</error>
<result>true</result>
<items>
	<item>
		<entrykey>EE88ECA1-F205-9A74-1C41F00931943663</entrykey>
		<type>1</type>
		<direction>1</direction>
		<createdbyuserkey>CC88ECA1-F205-9A74-1C41F00931943663</createdbyuserkey>
		<createdbyusername>peter79</createdbyusername>
		<objecttitle>Red Alert - Basement Jaxx</objecttitle>
		<linked_objectkey>8B9BDB1E-90F7-2F9C-4D64024FD8D368E0</linked_objectkey>
		<dt_created>2008-07-17 16:38:58.0</dt_created>
		<comment>This is really great!</comment>
		<unread>1</unread>
		<recipients>mailto:username@domain.com,user:tunesBagusername1</recipients>
</items>
</result>

List all recommendations: http://www.tunesBag.com/api/rest/social/recommendations/list

List all open recommendations

Example XML response

<?xml version="1.0" encoding="UTF-8"?>
<result>
	<requestkey>3298F24D-C492-EDED-240B4C84563DD5B4</requestkey>
	<errormessage/>
	<error>0</error>
	<result>true</result>
	<items>
		<item>
			<dt_created>2008-07-17 16:38:58.0</dt_created>
			<entrykey>3175A5B7-FD3C-F24F-5FE85D881815C1DF</entrykey>
			<mediaitemkey>8B9BDB1E-90F7-2F9C-4D64024FD8D368E0</mediaitemkey>
			<mediaitemtype>0</mediaitemtype>
			<recipient>2406ECA1-F205-9A74-1C41F00931943663</recipient>
			<recipient_type>0</recipient_type>
			<userkey>8B96E539-90E2-1D5F-8E9D17392106E782</userkey>
			<viewed>0</viewed>
			<comment>You have to listen to that one - reminds me of Snow Patrol but much better!</comment>
			</item>
		</items>
</result> 

Get information about new items (tracks, playlists) of friends http://tunesBag.com/api/rest/social/explore/newitems

Parameters

Response

 //qnewupdatedplaylists XML  information about playlists with favourite artists
//qnewtracksartists  XML information about new tracks of certain artists

Example XML response

<?xml version="1.0" encoding="UTF-8"?>
<result>
	<errormessage/>
	<error>0</error>
	<result>true</result>
	<requestkey>55921C69-ED2A-5FD7-6AEF5B4025D89511</requestkey>
	<qnewupdatedplaylists>
		<item>
			<artists/>
			<avgrating>0</avgrating>
			<description/>
			<dt_created>2008-05-15 21:52:17.0</dt_created>
			<entrykey>EF23D997-EF23-72E0-04408810FE5F1A3A</entrykey>
			<hits>0</hits>
			<itemscount>5</itemscount>
			<name>testplaylist 123</name><
			privacy_playlists>0</privacy_playlists>
			<tags/>
			<totaltime>1395</totaltime>
			<track_names/>
			<userkey>EF96E539-90E2-1D5F-8E9D17392106E442</userkey>
			<username>free.music</username>
		</item>
	</qnewupdatedplaylists>
	<qnewtracksartists>
		<item>
			<artist>Alex Gopher</artist>
			<counter>1</counter>
			<mb_artistid>15099</mb_artistid>
		</item>
		<item>
			<artist>Dinosaur Jr</artist>
			<counter>1</counter>
			<mb_artistid>1182</mb_artistid>
		</item>
	</qnewtracksartists>
</result> 

Get artist information (fans, events, etc) http://www.tunesBag.com/api/rest/social/artist/info

Return some artist information

Parameters

artist string  name of artist

Response

//events/ XML event information
//playlists/ XML  playlists with this artis
//fans/ XML fans of this artist

Example XML response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>1ED8F5C1-9A40-C9CE-10D75D1BAFB3D8F1</requestkey>
<errormessage/>
<error>0</error><result>true</result>
<events>
	<item>
		<address>1003 Arch St</address>
		<artist>Massive Attack / Tricky</artist>
		<city>Philadelphia</city>
		<country>us</country>
		<description>
			Tricky has been for over a decade one of the seminal figures in electronic music. *
		</description>
		<entrykey>1ED47221-E82F-4A6C-3E09293023D9360B</entrykey>
		<latitude>39.9536</latitude>
		<longitude>-75.1564</longitude>
		<name>Tricky</name>
		<source>upcoming</source>
		<start>2008-09-05 20:00:00.0</start>
		<url/>
		<venue_name>Trocadero Theater</venue_name>
		<zipcode>19107</zipcode>
	</item>
</events>
<playlists>
	<item>
		<description/>
		<entrykey>40368F24-D9E2-4327-CDF8D73EBDCB5AC1</entrykey>
		<name>Trip Hop Favourites</name>
		<tags/>
		<userkey>2406ECA1-F205-9A74-1C41F00931943663</userkey>
		<username>funkymusic</username>
	</item>
</playlists>
<fans>
	<item>
		<about_me>here goes some text</about_me>
		<pic>/res/images/profile_images/fun/funkymusic_big.jpg</pic>
		<userkey>CC06ECA1-EEEE-9A74-1C41F00931943993</userkey>
		<username>funkymusic</username>
	</item>
</fans>

</result> 

Various features and functions

Get message Inbox - http://www.tunesBag.com/api/rest/messages/get/

Read the Inbox / Outbox of the user

Return value Default return values plus

data string  The messages

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
	<requestkey>CEEF7374-BAC1-D654-302548869A5335DB</requestkey>
	<errormessage/>
	<error>0</error>
	<result>true</result>
	<data>
		<item>
			<body>123</body>
			<dt_created>2008-07-19 11:37:24.0</dt_created>
			<entrykey>3AAE465C-E539-8ED7-0A177CA073552B47</entrykey>
			<linked_objectkey/>
			<status_read>1</status_read>
			<subject/>
			<userkey_from>2406ECA1-F205-9A74-1C41F00931943663</userkey_from>
			<userkey_to>8B96E539-90E2-1D5F-8E9D17392106E782</userkey_to>
			<username_from>funkymusic</username_from>
			<username_to>free.music</username_to>
		</item>
	</data>
</result> 

Send a message - http://www.tunesBag.com/api/rest/messages/send/

Send a message

Parameters

 userkey_to  string  userkey of recipient
 subject  string  subject of message
 body  string  body of message

Return value Default return values plus

Send an invitation – http://www.tunesBag.com/api/rest/misc/sendinvitation/

Invite someone by email to become a friend on tunesBag.com. It’s the same as using the feature on the web page. Parameters

email  string  E-Mail Address (in the form of user@domain.com
customtext string  custom text to add (max 250 chars)

Log playing status of an item - http://www.tunesBag.com/api/rest/item/log/playstatus/

Log playing status of an item (seconds played)

Parameters

entrykey  string  entrykey of the mediaitem (track)
 seconds numeric  seconds played

Return value

Default return values (result/error/errormessage)

Check album cover images - http://www.tunesBag.com/api/rest/misc/check/albumcovers/

Check which album covers are available for the albums in the given libraries

Parameters

librarykeys string entrykey of libraries

Response

data  string string with information about the available album covers.

The album cover is stored in http://www.tunesBag.com/res/images/album_images/ Artist / Album .jpg

Example response

<?xml version="1.0" encoding="UTF-8"?>
<result>
<requestkey>93E44412-9F67-32EB-640C6577DB8E688D</requestkey><data>2raumwohnung|36grad
A Camp|A Camp
Aerosmith|Just Push Play
Aim|Cold Water Music
Air|Moon Safari
Alanis Morissette|The Collection
Alex Gopher|Alex Gopher
American Hi-Fi|American Hi-Fi
Babyshambles|Down In Albion
Bat For Lashes|Fur And Gold
Bran Van 3000|Discosis
Briskeby|Propaganda
Cat Power|You Are Free
Cat Power|The Greatest
Daft Punk|Discovery

Common links in the system

You can link to common information pages for more information about an artist etc

Artist page http://www.tunesBag.com/music/%ARTISTNAME% Artist Groove Armada
User page http://www.tunesBag.com/user/%USERNAME% User funkymusic

 User images http://www.tunesBag.com/res/images/profile_images/ %first three chars of the username% / %username% %small / big% .jpg Example


Comment by christopher.atlan, Jul 24, 2008

checklogin -> checkaccess

Comment by off...@tunesbag.com, Jul 30, 2008

fixed in doc


Sign in to add a comment
Hosted by Google Code