This way, we created a new playlist in the user's spotify account with the costumized data
IMPORTANT
The songs_uris are an array of strings contains each song's uri, learn about it here
api/spotify/createNewPlaylist/addSongs
We modified the original endpoint establish in the #6 ticket, because we are now calling the endpoint just to add the songs to the already created playlist
How to use this endpoint?
If you want to make use of this functionality in the Front-end, you need to follow this:
You need to import the createNewPlaylist() function from thelib/ folder
You use this function passing the access-token, the playlistName setted and thesongs-uris
This function will call the createNewDefaultPlaylist() in the backend and return a playlist_id. You need to pass the access-token and the playlistName to this function
Next, the backend will call the api/spotify/createNewPlaylist/addSongs wich will add the songs to the new playlist using the playlist_id
This is how this call should look like:
Then, if everything goes right the createNewPlaylist() function should return a response object with the snapshot_id data
About this Pull Request
Here I created a
createNewPlaylist
functionality that's capable of:How did we create a new playlist in the user's account ?
We accomplished this using the
Spotify API
, learn more here Here's the step by step:access-token
retrieved from the spotify API, learn how we did that here #22access-token
we make the rest of the API calls, passing it as aBearer token
, learn about it hereuser_id
, learn how we did it hereuser_id
we made a POST request to make a new empty/default playlists with theindicated name
, learn how to do it hereThis responds with a
playlist_id
which is the id for the new playlist createdmock-songs
the to previous and just created playlist using theplaylist_id
, learn how we did it hereIMPORTANT The songs_uris are an array of strings contains each song's uri, learn about it here
api/spotify/createNewPlaylist/addSongs
We modified the original endpoint establish in the #6 ticket, because we are now calling the endpoint just to add the songs to the already created playlist
How to use this endpoint?
If you want to make use of this functionality in the Front-end, you need to follow this:
createNewPlaylist()
function from thelib/
folderaccess-token
, theplaylistName
setted and thesongs-uris
createNewDefaultPlaylist()
in the backend and return aplaylist_id
. You need to pass theaccess-token
and theplaylistName
to this functionapi/spotify/createNewPlaylist/addSongs
wich will add thesongs
to the new playlist using theplaylist_id
createNewPlaylist()
function should return aresponse
object with thesnapshot_id
dataTest
See how it works: