Strict Standards: Declaration of base_page::setOutput() should be compatible with base::setOutput() in /data/premium-dev/application/controllers/base/base_page.php on line 8

Strict Standards: Declaration of base_page::printErrorAndExit() should be compatible with base::printErrorAndExit() in /data/premium-dev/application/controllers/base/base_page.php on line 8
Musicshake API for developers - categories

categories

Get the complete list of song filters - this method returns all available genres, tempos, and moods.

Parameters

  • api_key - developer key
  • callback (optional) - callback function name for a JSONP request

Request Example

http://developers.musicshake.com/api/categories?api_key=YOUR_API_KEY

Response Example

{
	"genres":[
		{"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"}
	],
	"tempos":[
		"90",
		"110",
		"120",
		"140"
	],
	"moods":[
		{"mood_id":"1","mood_name":"Cloudy"},
		{"mood_id":"2","mood_name":"Hopeful"},
		{"mood_id":"3","mood_name":"Fresh"},
		{"mood_id":"4","mood_name":"Dramatic"},
		{"mood_id":"5","mood_name":"Anticipation"},
		{"mood_id":"6","mood_name":"Calm"},
		{"mood_id":"7","mood_name":"Comfort"},
		{"mood_id":"8","mood_name":"Romantic"},
		{"mood_id":"9","mood_name":"Holiday"},
		{"mood_id":"10","mood_name":"Melancholy"},
		{"mood_id":"11","mood_name":"Warm"},
		{"mood_id":"12","mood_name":"Gentle"},
		{"mood_id":"13","mood_name":"Energetic"},
		{"mood_id":"14","mood_name":"Freedom"},
		{"mood_id":"15","mood_name":"Leisurely"},
		{"mood_id":"16","mood_name":"Lonesome"},
		{"mood_id":"17","mood_name":"Wedding"},
		{"mood_id":"18","mood_name":"Sad"},
		{"mood_id":"19","mood_name":"Passionate"}
	]
}

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/categories?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);
	}
	
	for each (var tempo:Object in o.tempos) {
		trace(tempo);
	}
	
	for each (var mood:Object in o.moods) {
		trace("id="+mood.mood_id + ", name="+mood.mood_name);
	}
}