Creating dynamic playlists

Learn how to create interesting dynamic playlists.

Details

The dynamic playlist method allows developers construct playlists that react to feedback from the listener. A listener can rate songs, skip songs, ban artists and the playlist method will adapt songs based upon this listener feedback. The dynamic playlist API is session based. You create a dynamic playlist using the same parameters that you would use to create a static playlist. However, instead of getting a whole playlist returned, the dynamic playlist api returns a single song, along with the session id for the playlist session. Subsequent calls to the playlist API can be made using just the session ID along with any feedback gathered from the user.

A dynamic version of similar Artist Radio

Generate a playlist of songs by similar artists

Response

{
    "response": {
        "session_id": "b031d33e246b42998c8f0346e07a036e", 
        "songs": [
            {
                "artist_id": "ARBKU7G1187FB5261B", 
                "artist_name": "The Rocket Summer", 
                "id": "SOLTFBT12A8C134743", 
                "title": "Colors"
            }
        ], 
        "status": {
            "code": 0, 
            "message": "Success", 
            "version": "4.2"
        }
    }
}

Getting the next song in the session

Generate a playlist of 80s power pop with a tempo between 120 and 130 BPM.

Response

    {
        "response": {
            "session_id": "b031d33e246b42998c8f0346e07a036e", 
            "songs": [
                {
                    "artist_id": "AR62BB21187B9AC83D", 
                    "artist_name": "The Breeders", 
                    "id": "SOGYIQL12A8C1329FC", 
                    "title": "No Aloha"
                }
            ], 
            "status": {
                "code": 0, 
                "message": "Success", 
                "version": "4.2"
            }
        }
        }

Ban the artist of the last returned track

Response

    {
        "response": {
            "session_id": "b031d33e246b42998c8f0346e07a036e", 
            "songs": [
                {
                    "artist_id": "AR3GZLR1187FB3D817", 
                    "artist_name": "Biffy Clyro", 
                    "id": "SOLLKKT12AB0184A56", 
                    "title": "Eye Lids"
                }
            ], 
            "status": {
                "code": 0, 
                "message": "Success", 
                "version": "4.2"
            }
        }
    }

Getting information about the current session

The session_info method will return detailed information about the current session including the song history, the list of skipped and banned songs, song ratings, playlist rules, top descriptive terms for the session, and so on.

Response

    {
        "response": {
            "banned_artists": [
                "AR62BB21187B9AC83D"
            ], 
            "banned_songs": [], 
            "description": [], 
            "history": [
                {
                    "artist_id": "ARBKU7G1187FB5261B", 
                    "artist_name": "The Rocket Summer", 
                    "id": "SOLTFBT12A8C134743", 
                    "served_time": 1308078856.4742789, 
                    "title": "Colors"
                }, 
                {
                    "artist_id": "ARDBSFT1187B9AC9C1", 
                    "artist_name": "Fountains of Wayne", 
                    "id": "SOOIKCR12A58A776D8", 
                    "served_time": 1308078958.2156169, 
                    "title": "Sink To The Bottom (LP Version)"
                }, 
                {
                    "artist_id": "AR62BB21187B9AC83D", 
                    "artist_name": "The Breeders", 
                    "id": "SOGYIQL12A8C1329FC", 
                    "served_time": 1308078991.1560071, 
                    "title": "No Aloha"
                }, 
                {
                    "artist_id": "AR3GZLR1187FB3D817", 
                    "artist_name": "Biffy Clyro", 
                    "id": "SOLLKKT12AB0184A56", 
                    "served_time": 1308079110.0484099, 
                    "title": "Eye Lids"
                }
            ], 
            "playlist_type": "artist-radio", 
            "rated_songs": [], 
            "rules": [
                {
                    "rule": "Don't put two copies of the same song in a playlist."
                }, 
                {
                    "rule": "Give preference to artists that are not already in the playlist"
                }
            ], 
            "seed_catalogs": [], 
            "seed_songs": [], 
            "seeds": [
                "AR633SY1187B9AC3B9"
            ], 
            "session_id": "b031d33e246b42998c8f0346e07a036e", 
            "skipped_songs": [], 
            "status": {
                "code": 0, 
                "message": "Success", 
                "version": "4.2"
            }, 
            "terms": [
                {
                    "frequency": 1.0, 
                    "name": "rock"
                }, 
                {
                    "frequency": 0.75348288868038071, 
                    "name": "alternative rock"
                }, 
                {
                    "frequency": 0.74682179537216942, 
                    "name": "indie rock"
                }, 
            ]
        }
    }