Open ZoeyOneOhOne opened 4 years ago
It seems to be working over here, used the same playlist as above.
That's really interesting... I will try to figure something out when I get off work and I'll let you know. Thank you for getting back to me.
Ya I still can't get this particular call to work. Any ideas?
At first everything seems fine in your code, I'm just not sure how you are calling the function. Either way here's a snippet that works.
var SpotifyWebApi = require("spotify-web-api-node");
let spotifyApi = new SpotifyWebApi();
spotifyApi.setAccessToken(process.env.ACCESS_TOKEN);
async function getSlamsPlaylist(playlistID) {
let playlistObj = (await spotifyApi.getPlaylist(playlistID)).body;
//do something with playlistObj
console.log(playlistObj);
}
getSlamsPlaylist("7CoPUH1fJFKzcc7NAIv9XU");
// without async
function getSlamsPlaylistV2(playlistID) {
spotifyApi
.getPlaylist(playlistID)
.then(res => console.log(res.body))
.catch(err => console.log(err));
}
getSlamsPlaylistV2("7CoPUH1fJFKzcc7NAIv9XU");
The first function returns "uncaught exception: Object" but the second one returns: "{\n \"error\" : {\n \"status\" : 404,\n \"message\" : \"Invalid playlist Id\"\n }\n}" regardless of which playlist ID I try to use. Other spotify api calls I have in my app work just fine. Only this call is acting weird.