genres
Get the list of all available genres.
Parameters
- api_key - developer key
- callback (optional) - callback function name for a JSONP request
Request Example
http://developers.musicshake.com/api/genres?api_key=YOUR_API_KEY
Response Example
[ {"genre_id":"1","genre_name":"Pop"}, {"genre_id":"2","genre_name":"New Age"}, {"genre_id":"3","genre_name":"Rock"}, {"genre_id":"4","genre_name":"Latin"}, {"genre_id":"5","genre_name":"Electronic"}, {"genre_id":"6","genre_name":"Jazz"}, {"genre_id":"7","genre_name":"Hiphop"}, {"genre_id":"8","genre_name":"Ballad"}, {"genre_id":"9","genre_name":"R&B"}, {"genre_id":"10","genre_name":"Dance"}, {"genre_id":"11","genre_name":"Trance"}, {"genre_id":"12","genre_name":"Instrumental"} ]
ActionScript Example
import com.adobe.serialization.json.JSON;
import flash.net.URLLoader;
import flash.events.Event;
import flash.events.IOErrorEvent;
private function loadCategories():void
{
var requestURL:String = "http://developers.musicshake.com/api/genres?api_key=YOUR_API_KEY";
var ul:URLLoader = new URLLoader();
ul.addEventListener(IOErrorEvent.IO_ERROR, onURLLoaderError);
ul.addEventListener(Event.COMPLETE, onURLLoaderComplete);
try {
ul.load(new URLRequest(requestURL));
} catch (error:SecurityError) {
}
}
private function onURLLoaderError(error:Error):void
{
}
private function onURLLoaderComplete(event:Event):void
{
var o:Object = JSON.decode(event.target.data);
for each (var genre:Object in o.genres) {
trace("id=" + genre.genre_id + ", name="+genre.genre_name);
}
}