Closed timseverien closed 8 years ago
@timseverien Thanks for a very well written bug report!
In your "Test code", I assume you are calling spotifyApi.getPlaylistTracks()
and not spotifyApi.getPlaylist()
.
I have tried with a small example, same environment as yours, and I'm not able to reproduce the issue:
var spotifyApi = new SpotifyWebApi({
clientId : '<something>',
clientSecret : '<something>'
});
spotifyApi.clientCredentialsGrant()
.then(function(data) {
spotifyApi.setAccessToken(data.body['access_token']);
return spotifyApi.getPlaylistTracks('jmperezperez', '6pasABEDetvB8I2vh9avye', {
offset: 5,
limit: 10
});
}).then(function(data) {
console.log(data.body);
}).catch(function(err) {
console.log('Unfortunately, something has gone wrong.', err.message);
});
When run, this is the output it generates:
{ href: 'https://api.spotify.com/v1/users/jmperezperez/playlists/6pasABEDetvB8I2vh9avye/tracks?offset=5&limit=10',
items:
[ { added_at: '2016-08-15T14:49:51Z',
added_by: [Object],
is_local: false,
track: [Object] },
...
{ added_at: '2016-08-15T14:49:51Z',
added_by: [Object],
is_local: false,
track: [Object] } ],
limit: 10,
next: 'https://api.spotify.com/v1/users/jmperezperez/playlists/6pasABEDetvB8I2vh9avye/tracks?offset=15&limit=10',
offset: 5,
previous: 'https://api.spotify.com/v1/users/jmperezperez/playlists/6pasABEDetvB8I2vh9avye/tracks?offset=0&limit=5',
total: 25 }
The href
, next
and previous
are correct. Would you mind double checking or providing a simple code snippet that we can run to try to find out what is happening?
I'm closing this issue for now since it doesn't seem to be a bug. Feel free to reopen it.
Test code
Current behaviour:
The above code logs the URL:
Expected behaviour:
It should log following URL, confirmed via the Spotify Web API Console.
Suggestion
Interestingly, the
offset
in the next URL appears to work. Theoffset
parameter, however, seems to be ignored. I tried to find the issue myself, but no luck thus far.My guess is that the offset parameter is accidentally omitted when an URL is generated.