Reputation: 3879
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
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