Subscribe
You can subscribe to the specified playlist.
Endpoint URL
/api/users/:user_id/playlist_subscriptions/:playlist_id
HTTP Method
PUT
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 |
| playlist_id | required | A playlist ID. | pl130560517973607168 |
Response Elements
| Response | Description |
|---|---|
| code |
Beats API response code. OK if successful; otherwise an error code is returned. |
Example Request
Suppose you would like to subscribe to a playlists you discovered when you used the Collection API: "Born to Run" appeared in the results, with playlist ID pl130560517973607168. You can add this playlist to your subscriptions.
Since you are adding these subscriptions on behalf of a user, you will need their user ID. Recall that when you first created a playlist for the user, a response containing the user ID was returned:
{
"data": {
...
},
"refs": {
...
"user": {
"ref_type": "user",
"display": "[YOUR_USER_NAME]",
"id": "150470956064702464"
},
...
}
"code": "OK"
}
You will need to provide the user ID, the playlist ID, and your access token. The general form of this API is:
curl -X PUT "https://partner.api.beatsmusic.com/v1/api/users/[YOUR_USER_ID]/playlist_subscriptions/[PLAYLIST_ID]?
access_token=[YOUR_ACCESS_TOKEN]"
In this example we will subscribe the user to the playlist ID you just retrieved:
curl -X PUT "https://partner.api.beatsmusic.com/v1/api/users/150470956064702464/playlist_subscriptions/pl130560517973607168?
access_token=[YOUR_ACCESS_TOKEN]"
Example Response
Open the Beats Music app on your mobile device and select My Playlists > Subscriptions. You will see that the playlist "Born to Run" now appears in your subscriptions! You can also confirm the new subscriptions by invoking the Subscriptions: User API.
Here is the API response indicating that you have successfully subscribed to the playlist:
{"code":"OK"}

