edcs
edcs

Reputation: 3879

Spotify App API - Playlist Subscribe

Looking at the APP API, it seems like you can determine whether or not a user is subscribed to a playlist or not. However, my app requires the user to be able to subscribe or un-subscribe from a playlist.

Is this possible using the Javascript App API at all?

Upvotes: 1

Views: 828

Answers (1)

Ivan Navarrete
Ivan Navarrete

Reputation: 535

For the currently logged in user you can subscribe and unsubscribe from a playlist by setting the playlist's subscribed property.

var m = sp.require('sp://import/scripts/api/models')
var playlist = m.Playlist.fromURI('spotify:user:<otherUser>:playlist:<playlist>')

playlist.subscribed

> false

playlist.subscribed = true
playlist.subscribed

> true

playlist.subscribed = false
playlist.subscribed

> false

Upvotes: 5

Related Questions