addTracksToClientPlaylistRestAction

fun addTracksToClientPlaylistRestAction(playlist: String, vararg tracks: String, position: Int? = null): SpotifyRestAction<Unit>

Add one or more tracks to a user’s playlist.

Adding tracks to the current user’s public playlists requires authorization of the SpotifyScope.PLAYLIST_MODIFY_PUBLIC scope; adding tracks to the current user’s private playlist (including collaborative playlists) requires the SpotifyScope.PLAYLIST_MODIFY_PRIVATE scope.

Api Reference

Parameters

playlist

The id or uri for the playlist.

tracks

Spotify track ids. Maximum 100

position

The position to insert the tracks, a zero-based index. For example, to insert the tracks in the first position: position=0; to insert the tracks in the third position: position=2. If omitted, the tracks will be appended to the playlist. Tracks are added in the order they are listed in the query string or request body.

Throws

if any invalid track ids is provided or the playlist is not found

Sources

(source)
Link copied to clipboard