Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_recommendations bad request error #194

Open
NoahFHenry opened this issue Mar 13, 2023 · 0 comments
Open

get_recommendations bad request error #194

NoahFHenry opened this issue Mar 13, 2023 · 0 comments

Comments

@NoahFHenry
Copy link

Hi,

Sorry if this is a dumb question in advance, I'm pretty new to coding in general so don't have the best understanding. I've encountered a Bad Request (400) error when trying to run the get_recommendations and add_tracks_to_playlist functions, but cannot figure out why as other functions seem to be working fine. I've run this syntax before without any issues, but seemingly get an empty vector when I run the get_recommendations argument, and an HTTP 400 error when trying to add things to a playlist. For clarity, here is the relevant part of the syntax I'm having trouble with:

`# packages
library(spotifyr)
library(lubridate)
library(knitr)
library(httpuv)

Sys.setenv(SPOTIFY_CLIENT_ID = 'MY_CLIENT_ID')
Sys.setenv(SPOTIFY_CLIENT_SECRET = 'MY_CLIENT_SECRET')
access_token <- get_spotify_access_token()

recommendations (no problems in prior use)

recommended_tracks <- get_recommendations(limit = 25, market = "GB", seed_artists = NULL,
seed_genres = "folk", seed_tracks = NULL,
target_acousticness = 0.400, target_danceability = NULL,
target_duration_ms = NULL, target_energy = 0.500,
target_instrumentalness = 0.300, target_popularity = NULL,
target_speechiness = NULL, target_tempo = NULL, target_valence = 0.400,
authorization = get_spotify_access_token(), include_seeds_in_response = FALSE)

create playlist (this bit works fine)

my_playlist <- create_playlist("MY_USERNAME", name = "Test Playlist: Folk", public = TRUE, collaborative = FALSE,
description = "Test", authorization = get_spotify_authorization_code())

add tracks to playlist (this is where the bad request error comes up)

add_tracks_to_playlist(my_playlist$id, uris = recommended_tracks $uri, authorization = get_spotify_authorization_code())`

Seeing as I've run this before without issues, I thought it might be something to do with the wrapper or the API? It doesn't make much sense to me as I don't think there is much wrong with the syntax. I'd be grateful for any help/advice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant