nleroy917 / spottydata-api

Backend and Web API for spottydata.com
MIT License
7 stars 0 forks source link

New Endpoint: <playlist_id>/analysis/genre #8

Closed nleroy917 closed 4 years ago

nleroy917 commented 4 years ago

Create a new API endpoint to get the genre information on the playlists. It will take each track, pull the genre, and populate an object to return with each genre and the counts each time that genre occurs in the playlist.

Required Params: Spotify Playlist ID Number Headers: Authorization: <access_token> Route: <playlist_id>/analysis/genres Return Type: JSON Object Format: {pop: 2, hip-hop: 4, pop-rock: 9, ...}

This will allow for easy integration into a Chart.JS radar chart.

nleroy917 commented 4 years ago

It seems that the https://api.spotify.com/v1/tracks/{track_id} endpoint doesn't return a genre for a track... The only endpoint that houses genre data would be the artists endpoint... I will need to probably "detour" and get the artist from the track, and then pull the artist data and find their genres and use that information to populate the genres object I want to return.

Use: GET https://api.spotify.com/v1/artists/{id}

nleroy917 commented 4 years ago

Endpoint created and fully tested. Closing issue.