Matdweb / Jamming

This project allows you 👥 to create and customize 🎨 playlists 🎼 and send them to your Spotify account using API technology.
https://jamming-sooty.vercel.app
MIT License
0 stars 1 forks source link

createNewPlaylists endpoint functionality #6

Closed Matdweb closed 1 year ago

Matdweb commented 1 year ago

About the Issue

You are ask to create an API endpoint api/spotify/createNewPlaylists capable of:

CreateNewPlaylist functionality

This functionality is all about giving the user the opportunity send the new playlist they have customized and created (in our Jamming app) to their own Spotify accounts.

The Button used to trigger this functionality is indicated here: Captura de pantalla 2023-09-20 201342

IMPORTANT This ticket doesn't cover the Button functionality. For that check this other ticker #26 So the Button will have no colors and animations

Playlist customization

For this ticket we just want the customization to cover:

  1. The playlists name indicated here by the user: Captura de pantalla 2023-09-20 201908
  2. And in this case the mock-songs assign by default to the state

    This meaning that the state will provide mock-data for you to use and add as default to the playlists to create Learn more about this app's state here #21

How to create this using the Spotify API?

Here's what you need to know to accomplish this functionality with the Spotify API:

  1. You need to have the access-token retrieved from the spotify API, learn how we did that here #22
  2. With this access-token you are going to make the rest of the calls, passing it as a Bearer token, learn about it here
  3. You need to request the user-id, learn how to do it here
  4. Then, with the user-id you need to make a POST request to make a new empty/default playlists with the indicated name, learn how to do it here
  5. Next, you need to add the mock-songs the to previous and just created playlist, learn how to do it here
  6. This way, you should see a new created playlist in the user's spotify account with the costumized data

Learn more about the Spotify API here

api/spotify/createNewPlaylist

Now, in order for you to make the previous process, you first need to create a api/spotify/createNewPlaylist endpoint for this app. This way the API requests are going to be handled securely

Learn about next.js API endpoints

Expected data

The data that we expect to be return from this api/spotify/createNewPlaylist endpoint is the a response object with a snapshot_id property returned from the last spotify API's call. Learn about that here

State management

You can learn about this app state management in #21 Pull Request This ticket must not save any data into the global state

Display the data

For the moment you just need to console.log the response!