Class PlaylistsApi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTracksToPlaylist(String playlistId, List<String> uris) Add Items to PlaylistchangePlaylistDetails(String playlistId) Change Playlist DetailscreatePlaylist(String userId, String name) Create PlaylistgetCategoriesPlaylists(String categoryId) Get Category's PlaylistsGet Featured PlaylistsGet Current User's PlaylistsgetListUsersPlaylists(String userId) Get User's PlaylistsgetPlaylist(String playlistId) Get PlaylistgetPlaylistCover(String playlistId) Get Playlist Cover ImagegetPlaylistsTracks(String playlistId) Get Playlist ItemsRemove Playlist ItemsreorderPlaylistsTracks(String playlistId, int rangeStart, int insertBefore) Reorder Playlist ItemsreplacePlaylistsTracks(String playlistId, List<String> uris) Replace Playlist ItemsuploadCustomPlaylistCover(String playlistId, String base64Image) Add Custom Playlist Cover Image
-
Constructor Details
-
PlaylistsApi
public PlaylistsApi()
-
-
Method Details
-
addTracksToPlaylist
Add Items to Playlist
Add one or more items to a user's playlist.
- Parameters:
playlistId-The Spotify ID of the playlist.
uris-A JSON array of the Spotify URIs to add. For example:
{"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}
A maximum of 100 items can be added in one request. Note: if theurisparameter is present in the query string, any URIs listed here in the body will be ignored.- Returns:
- a
AddTracksToPlaylistRequestobject to build and execute the request
-
changePlaylistDetails
Change Playlist Details
Change a playlist's name and public/private state. (The user must, of course, own the playlist.)
- Parameters:
playlistId-The Spotify ID of the playlist.
- Returns:
- a
ChangePlaylistDetailsRequestobject to build and execute the request
-
createPlaylist
Create Playlist
Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)
- Parameters:
userId-The user's Spotify user ID.
name-The name for the new playlist, for example
"Your Coolest Playlist". This name does not need to be unique; a user may have several playlists with the same name.- Returns:
- a
CreatePlaylistRequestobject to build and execute the request
-
getCategoriesPlaylists
Get Category's Playlists
Get a list of Spotify playlists tagged with a particular category.
- Parameters:
categoryId-The Spotify category ID for the category.
- Returns:
- a
GetCategoriesPlaylistsRequestobject to build and execute the request
-
getFeaturedPlaylists
Get Featured Playlists
Get a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).
- Returns:
- a
GetFeaturedPlaylistsRequestobject to build and execute the request
-
getListOfCurrentUsersPlaylists
Get Current User's Playlists
Get a list of the playlists owned or followed by the current Spotify user.
- Returns:
- a
GetListOfCurrentUsersPlaylistsRequestobject to build and execute the request
-
getListUsersPlaylists
Get User's Playlists
Get a list of the playlists owned or followed by a Spotify user.
- Parameters:
userId-The user's Spotify user ID.
- Returns:
- a
GetListUsersPlaylistsRequestobject to build and execute the request
-
getPlaylist
Get Playlist
Get a playlist owned by a Spotify user.
- Parameters:
playlistId-The Spotify ID of the playlist.
- Returns:
- a
GetPlaylistRequestobject to build and execute the request
-
getPlaylistCover
Get Playlist Cover Image
Get the current image associated with a specific playlist.
- Parameters:
playlistId-The Spotify ID of the playlist.
- Returns:
- a
GetPlaylistCoverRequestobject to build and execute the request
-
getPlaylistsTracks
Get Playlist Items
Get full details of the items of a playlist owned by a Spotify user.
- Parameters:
playlistId-The Spotify ID of the playlist.
- Returns:
- a
GetPlaylistsTracksRequestobject to build and execute the request
-
removeTracksPlaylist
public RemoveTracksPlaylistRequest removeTracksPlaylist(String playlistId, List<Map<String, Object>> tracks) Remove Playlist Items
Remove one or more items from a user's playlist.
- Parameters:
playlistId-The Spotify ID of the playlist.
tracks-An array of objects containing Spotify URIs of the tracks or episodes to remove. For example:
{ "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },{ "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }. A maximum of 100 objects can be sent at once.- Returns:
- a
RemoveTracksPlaylistRequestobject to build and execute the request
-
reorderPlaylistsTracks
public ReorderPlaylistsTracksRequest reorderPlaylistsTracks(String playlistId, int rangeStart, int insertBefore) Reorder Playlist Items
Reorder items in a playlist
- Parameters:
playlistId-The Spotify ID of the playlist.
rangeStart-The position of the first item to be reordered.
insertBefore-The position where the items should be inserted.
To reorder the items to the end of the playlist, simply set insert_before to the position after the last item.
Examples:
To reorder the first item to the last position in a playlist with 10 items, set range_start to 0, and insert_before to 10.
To reorder the last item in a playlist with 10 items to the start of the playlist, set range_start to 9, and insert_before to 0.- Returns:
- a
ReorderPlaylistsTracksRequestobject to build and execute the request
-
replacePlaylistsTracks
Replace Playlist Items
Replacing items in a playlist will overwrite its existing items. This operation can be used for replacing or clearing items in a playlist.
- Parameters:
playlistId-The Spotify ID of the playlist.
uris-- Returns:
- a
ReplacePlaylistsTracksRequestobject to build and execute the request
-
uploadCustomPlaylistCover
public UploadCustomPlaylistCoverRequest uploadCustomPlaylistCover(String playlistId, String base64Image) Add Custom Playlist Cover Image
Replace the image used to represent a specific playlist.
- Parameters:
playlistId-The Spotify ID of the playlist.
base64Image-Base64 encoded JPEG image data, maximum payload size is 256 KB.
- Returns:
- a
UploadCustomPlaylistCoverRequestobject to build and execute the request
-