close
The Wayback Machine - https://web.archive.org/web/20140813151856/https://developer.beatsmusic.com/docs/read/playlists/Track_Fetch

Tracks: Fetch

You can get the tracks for a playlist.


Endpoint URL

/api/playlists/:playlist_id/tracks


HTTP Method

GET


Authentication

OAuth 2.0: Access token required. See Authentication for examples and details.


Parameters

Name Required Description Example
playlist_id required The unique ID for the playlist. pl130560517973607168
offset optional A zero-based integer offset into the results. Default 0. 0
limit optional Specifies the maximum number of records to retrieve. The number of results returned will be less than or equal to this value. No results are returned if it is set to zero or less. The maximum permitted value is 200. If a value higher than 200 is specified, no more 200 results will be returned. Default 20. 20
refs optional An array of referenced objects to include in the response. Only the requested ref collections will be returned. Default is to return all refs. Values: artists, album. artists
order_by optional Indicates how the results set should be sorted.
Values (default is popularity desc):
popularity desc Order by descending predicted popularity. This is the default value.
popularity Equivalent to popularity desc.
title asc Order alphabetically by title.
title Equivalent to title asc.
title desc Sort in in reverse alphabetical order by title.
release_date asc Sort in ascending order by release date (oldest first).
release_date Equivalent to release_date asc.
original_release_date Equivalent to original_release_date asc.
release_date desc Sort in descending order by release date (newest first).
title
streamability filters optional Array of streamability filter operations to apply. Each operation is filter:value.
Streamability refers to whether an entity, such as a track or album, can be streamed. Each entity can be in one of three states:
  • streamable: The entity can currently be streamed
  • future_streamable: The entity is scheduled to be streamable sometime in the future.
  • never_streamable: The entity is not currently streamable and not scheduled to be streamable in the future.

Values:

streamable:true|false Determines whether to include streamable entities. Default streamable:true.
future_streamable:true|false Determines whether to include future_streamable entities. Default future_streamable:false.
never_streamable:true|false Determines whether to include never_streamable entities. Default never_streamable:false.


Example:
filters=streamable:false&filters=future_streamable:true


Response Elements

ResponseDescription
code

Beats API response code. OK if successful; otherwise an error code is returned.

info

Contains paging information used to display the results.

offset

A zero-based integer offset into the results. Default 0.

count

The number of results returned for this request.

total

The total number of elements available for this resource.

data

List of tracks matching the request. Each element is a track object:

type

The entity type of the API object.

id

The unique ID of the artist.

title

The title of the album (including remarks indicating the edition).

artist_display_name

A string representing the name to display as the artist credit.
Example:
Jay Z & Kanye West

duration

Total duration of the audio, in seconds.

parental_advisory

Indicates whether the item has a parental advisory (explicit) warning.

edited_version

Indicates whether the item has is an edited version of an explicit song.

popularity

The current projected popularity, relative to other items of the same type, on a scale from 0.0 to 1.0.
Note: This does not necessarily reflect historic popularity of the item, as new items can be assigned high popularity based on projected demand.

track_position

The position of the track in the album’s ordered track sequence, starting from 1. If the album is multi-disc, only the first track of the first disc starts from one – the others start from where the previous disc left off.

disc_number

If the track is from a multi-disc album, the disc number on which this track appears; otherwise 1.

streamable

Indicates whether the currently logged-in user has rights to stream the track.

refs

Object with keys corresponding to referenced object types, and values providing the information needed for linking to the objects.
ref_type
The API object type of the referenced item.
id
The unique ID of the referenced item.
display
Text to be displayed when displaying a link to the referenced item.


Example Request

Suppose you would like to retrieve the tracks for a public playlist that appears on your Beats Music app: "Born to Run". You can use the Search API to look up its playlist ID:

curl -X GET "https://partner.api.beatsmusic.com/v1/api/search?
    q=born+to+run
    &type=playlist
    &client_id=[YOUR_CLIENT_ID]"

Here is the response:

{
    "data": [
        {
            "type": "search_result",
            "result_type": "playlist",
            "id": "pl130560517973607168",
            "display": "Born to Run",
            "detail": "Beats Classic Rock",
            "related": {
                "ref_type": "playlist",
                "id": "pl130560517973607168",
                "display": "Born to Run"
            }
        },
    ...
    ],
    "info": {
        "offset": 0,
        "count": 20,
        "total": 6350
    },
    "code": "OK"
}

We will use the playlist ID we found in the response above (pl130560517973607168) to retrieve the tracks for that playlist. You will need to use your access token.

The general form of this API is:

curl -X GET "https://partner.api.beatsmusic.com/v1/api/playlists/[PLAYLIST_ID]/tracks?
    access_token=[YOUR_ACCESS_TOKEN]"

In this example we will retrieve the tracks for the playlist ID you just retrieved:

curl -X GET "https://partner.api.beatsmusic.com/v1/api/playlists/pl130560517973607168/tracks?
    access_token=[YOUR_ACCESS_TOKEN]"

Example Response

Here is the API response indicating that you have successfully retrieved the tracks for the playlist:

{
    "data": [
        {
            "type": "track",
            "id": "tr45856473",
            "title": "1969",
            "disc_number": 1,
            "parental_advisory": false,
            "edited_version": false,
            "duration": 247,
            "track_position": 1,
            "popularity": 562,
            "streamable": true,
            "release_date": "1969-08-05",
            "artist_display_name": "Iggy & The Stooges",
            "refs": {
                "artists": [
                    {
                        "ref_type": "artist",
                        "id": "ar14198",
                        "display": "Iggy and The Stooges"
                    }
                ],
                "album": {
                    "ref_type": "album",
                    "id": "al45856471",
                    "display": "The Stooges"
                }
            }
        },
        ...
    ],
    "info": {
        "offset": 0,
        "count": 14,
        "total": 14
    },
    "code": "OK"
}

Docs Navigation