Link Search Menu Expand Document

moment.getActivityTracks

Returns suggested tracks for the current moment given an acivity selected by the user.

Example URL

https://api.melodia.io/v1/moment.getActivityTracks?userKey=a4b5G982H3r9Vf783EEd&forActivity=running&timestamp=1625294543&location_latitude=37.445099&location_longitude=-122.160362&location_altitude=9.1&count=5

Params

paramrequireddescriptiontype
userKeyYA unique ID to be associated with the new userString
forActivityYCustom activity selected by user. Can be either of the following: stationary, walking, running, biking, drivingString
timestampNCurrent moment’s Unix timestamp (in seconds). Defaults to current timestamp.Int
location_latitudeNCurrent moment’s location’s latitude (in degrees)Float
location_longitudeNCurrent moment’s location’s longitude (in degrees)Float
location_altitudeNCurrent moment’s location’s altitude (in meters)Float
min_tempoNFilter recommendations to this minimum tempo (beats per minute)Int
max_tempoNFilter recommendations to this maximum tempo (beats per minute)Int
countNNumber of suggested tracks to return (defaults to 10)Int

Auth

This service requires authentication. Refer to Authentication for more details.

Sample Response

{
    "statusCode": 200,
    "body":
        "forActivity": "driving",
        "tracks": [
        {
            "trackKey": "MT239432948",
            "title": "Where the Streets have no name",
            "artist": "U2",
            "artistKey": "MA29FE4f3gXj",
            "artwork100": "http://akamai-b.cdn.cddbp.net/cds/2.0/cover/D7E5/6608/B546/60CD_xlarge_front.jpg"
            ...
        },
        {
            "trackKey": "MT23WMd2948",
            "title": "I'm On Fire",
            "artist": "Bruce Springsteed",
            "artistKey": "MA29FE3243gXj",
            "artwork100": "http://akamai-b.cdn.cddbp.net/cds/2.0/cover/D7E5/6608/B546/60CD_xlarge_front.jpg"
            ...
        }
    ]
}

Discussion

Call this method to get track suggestions for the user’s current moment according to an activity that is selected by the user. For example, the user might want to get suggestions for his current moment if he were to go for a run. Melodia looks at the user’s past lisetening patters to find the optimal set of songs that the user is most likely to enjoy at that time for the selected activity.