close
The Wayback Machine - https://web.archive.org/web/20140813151105/https://developer.beatsmusic.com/docs/read/mymusic/Tracks

Tracks

You can get the tracks list in My Library.


Endpoint URL

/api/users/:user_id/mymusic/tracks


HTTP Method

GET


Authentication

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


Parameters

Name Required Description Example

user_id

required The unique ID for the user. 150470956064702464

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 150. If a value higher than 150 is specified, no more 150 results will be returned. Default 40. 40

order_by

optional Indicates how the results set should be sorted.
Values:

 

title Order alphabetically by title. This is the default.
date_added Sort in descending order by listing the most recently added tracks.
shuffle Sort in random order.
shuffle
 

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. Always matches the parameter value if it was specified.

count

The number of results returned for this request.

total

The total number of elements available for this resource.

data

A list of track objects:

type

The entity type of the API object.

id

The unique ID of the track.

title

The title of the song corresponding to this track (including remarks indicating the version).

artist_display_name

A string representing the name to display as the artist credit.

Example:
Jay Z & Kanye West

duration

The 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.

explicit_add

Indicates whether the item was explicitly added to My Library.

delete_sideeffect

Indicates whether deleting the item will impact playlist content.

added_at

Epoch timestamp indicating when the item was added to the collection.

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

One of the central activities for a user is to add and remove albums and tracks in My Library. Suppose you have retrieved a list of subscribers for the playlist "Born to Run" (see Subscribers), and you would like to find out more about one of the subscribers listed in the response:

{
    "data": [
        {
            "type": "user",
            "id": "150470956064702464",
            "username": "[USER_NAME]",
            "full_name": "[USER_FULL_NAME]",
            "total_followed_by": 0,
            "total_follows": 0
        },
        ...
    ],
    ...
    "code": "OK"
}

We will use the user's ID (150470956064702464) to retrieve and display their tracks in My Library. To get the tracks a user currently has, you will need the user ID and an access token.

The general form of this API is:

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

In this example we will retrieve the tracks contained in My Library for user ID 150470956064702464:

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

Example Response

{
    "info": {
        "offset": 0,
        "count": 29,
        "total": 29
    },
    "data": [
        {
            "type": "mymusic_track",
            "id": "tr540889",
            "title": "A Thousand Years",
            "disc_number": 1,
            "parental_advisory": false,
            "edited_version": false,
            "duration": 358,
            "track_position": 1,
            "popularity": 3809,
            "streamable": true,
            "release_date": "1999-09-28",
            "artist_display_name": "Sting",
            "refs": {
                "artists": [
                    {
                        "ref_type": "artist",
                        "id": "ar31068",
                        "display": "Sting"
                    }
                ],
                "album": {
                    "ref_type": "album",
                    "id": "al540887",
                    "display": "Brand New Day"
                },
                "user": {
                    "ref_type": "user",
                    "display": "[USER_DISPLAY_NAME]",
                    "id": "150470956064702464"
                }
            },
            "added_at": 1394218269
        },
        ...
    ],
    "code": "OK"
}

Docs Navigation