Spotify App API - Playlist Subscribe

2019-04-02 13:37发布

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?

1条回答
够拽才男人
2楼-- · 2019-04-02 14:19

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
查看更多
登录 后发表回答