Skip to content

Instantly share code, notes, and snippets.

@JFriel
Created May 23, 2015 14:47
Show Gist options
  • Save JFriel/162072a696b39f64d60b to your computer and use it in GitHub Desktop.
Save JFriel/162072a696b39f64d60b to your computer and use it in GitHub Desktop.
String trackName = '4BYGxv4rxSNcTgT3DsFB9o' //replace this with a call to get the track ID
final List<String> tracksToAdd = Arrays.asList("spotify:track:"+trackName);
// Index starts at 0
final int insertIndex = 1;
final AddTrackToPlaylistRequest request = api.addTracksToPlaylist("thelinmichael", "5ieJqeLJjjI8iJWaxeBLuK", tracksToAdd)
.position(insertIndex)
.build();
try {
request.get();
} catch (Exception e) {
System.out.println("Something went wrong!" + e.getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment