Help Wizard

Step 1

NEXT STEP

Add to playlist button?

Add to playlist button?

Hello,

 

I have the spotify iframe player on my site but would also like to add an "add song to playlist" button on my site. Is there such a button? If yes, how do I implement it?

 

thanks!


D

Reply
3 Replies

Hello @dbbrante,

 

You can use the Spotify Web API:

 

Add Tracks to a Playlist

Description Add Tracks to a Playlist docs                                                                       
Endpoint https://api.spotify.com/v1/users/{user_id}/playlists/{playlist_id}/tracks
HTTP Method POST
OAuth Required
OAuth Scope playlist-modify-public, playlist-modify-private

 

 
 
 
 

Cool, are there any live examples of such a button outside spotify? Would be interested to see. Also, will I as the site owner know how many times someone added the song to their playlists?

Hey @dbbrante,

 

I don't know any, but the example in the doc is quite good.

As for the counter, I can offer you generic html/js counter:

 

<html>
<head>
    <title>Space Clicker</title>
</head>

<body>
    <script type="text/javascript">
    var clicks = 0;
    function onClick() {
        clicks += 1;
        document.getElementById("clicks").innerHTML = clicks;
    };
    </script>
    <button type="button" onClick="onClick()">Click me</button>
    <p>Clicks: <a id="clicks">0</a></p>

</body></html>

Source.

Suggested posts