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

currentUser.tracks.saveTracks 400s #131

Open
skysteve opened this issue Oct 4, 2024 · 3 comments
Open

currentUser.tracks.saveTracks 400s #131

skysteve opened this issue Oct 4, 2024 · 3 comments

Comments

@skysteve
Copy link

skysteve commented Oct 4, 2024

This was working up until recently, code hasn't changed but today I'm getting a 400.

Code:

await api.currentUser.tracks.saveTracks([track.id])

Response:

{"error": {"status": 400, "message": "Missing required field: ids" } }

Request:

Request URL:
https://api.spotify.com/v1/me/tracks
Request Method:
PUT
Status Code:
400 Bad Request

Looks like the payload is

["6QGeAZK8ot9IuiRe2tvIvx"]

Api docs: https://developer.spotify.com/documentation/web-api/reference/save-tracks-user

Looks like the payload body should be:

{
  "ids": ["6QGeAZK8ot9IuiRe2tvIvx"]
}

instead of just the raw array. Not sure what's changed here, if it's the API endpoint or what.

I'm on v1.2.0

@skysteve
Copy link
Author

skysteve commented Oct 4, 2024

as a workaround for now incase others land here

api.makeRequest("PUT", "me/tracks", {
  ids: [track.id],
})   

instead of api.currentUser.tracks.saveTracks will work

@Lysosome
Copy link

This also appears to be affecting the currentUser.albums.saveAlbums endpoint (and I expect the removeAlbums endpoint too).

@brandonporcel
Copy link

brandonporcel commented Nov 14, 2024

thanks for posting this issue, I didn't know why this error appeared

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

3 participants