# documented()
This example refreshes an access token. Refreshing access tokens is only possible access tokens received using the Authorization Code flow, documented here: https://developer.spotify.com/spotify-web-api/authorization-guide/#authorization_code_flow
# spotifyApi()
Get the credentials from Spotify's Dashboard page. https://developer.spotify.com/dashboard/applications
# spotifyApi()
Get the credentials from Spotify's Dashboard page. https://developer.spotify.com/dashboard/applications
# described()
This example demonstrates adding tracks, removing tracks, and replacing tracks in a playlist. At the time of writing this documentation, this is the available playlist track modification feature in the Spotify Web API. Since authorization is required, this example retrieves an access token using the Authorization Code Grant flow, documented here: https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow Codes are given for a set of scopes. For this example, the scopes are playlist-modify-public. Scopes are documented here: https://developer.spotify.com/documentation/general/guides/scopes/
# spotifyApi()
Get the credentials from Spotify's Dashboard page. https://developer.spotify.com/dashboard/applications
# described()
This example demonstrates adding tracks to a specified position in a playlist. Since authorization is required, this example retrieves an access token using the Authorization Code Grant flow, documented here: https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow Codes are given for a set of scopes. For this example, the scopes are playlist-modify-public. Scopes are documented here: https://developer.spotify.com/documentation/general/guides/scopes/
# spotifyApi()
Get the credentials from Spotify's Dashboard page. https://developer.spotify.com/dashboard/applications
# spotifyApi()
Get the credentials from Spotify's Dashboard page. https://developer.spotify.com/dashboard/applications
# documented()
This example retrieves information about the 'current' user. The current user is the user that has authorized the application to access its data.
# spotifyApi()
This endpoint doesn't require an access token, but it's beneficial to use one as it gives the application a higher rate limit. Since it's not necessary to get an access token connected to a specific user, this example uses the Client Credentials flow. This flow uses only the client ID and the client secret. https://developer.spotify.com/documentation/general/guides/authorization-guide/#client-credentials-flow
# spotifyApi()
Get the credentials from Spotify's Dashboard page. https://developer.spotify.com/dashboard/applications
# SpotifyWebApi()
This example is using the Authorization Code flow. In root directory run npm install express then run with the followinng command. If you don't have a client_id and client_secret yet, create an application on Create an application here: https://developer.spotify.com/my-applications to get them. Make sure you whitelist the correct redirectUri in line 26. node access-token-server.js "
# HttpManager.del(The, The)
Make a HTTP DELETE request.
Parameters
Name | Types | Description |
---|---|---|
The | BaseRequest |
request. |
The | Function |
callback function. |
# HttpManager.get(The, The)
Make a HTTP GET request.
Parameters
Name | Types | Description |
---|---|---|
The | BaseRequest |
request. |
The | Function |
callback function. |
# HttpManager.post(The, The)
Make a HTTP POST request.
Parameters
Name | Types | Description |
---|---|---|
The | BaseRequest |
request. |
The | Function |
callback function. |
# HttpManager.put(The, The)
Make a HTTP PUT request.
Parameters
Name | Types | Description |
---|---|---|
The | BaseRequest |
request. |
The | Function |
callback function. |
# authorizationCodeGrant(code, callback)
Request an access token using the Authorization Code flow. Requires that client ID, client secret, and redirect URI has been set previous to the call.
Parameters
Name | Types | Description |
---|---|---|
code | string |
The authorization code returned in the callback in the Authorization Code flow. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# clientCredentialsGrant(callback)
Request an access token using the Client Credentials flow. Requires that client ID and client secret has been set previous to the call.
Parameters
Name | Types | Description |
---|---|---|
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# createAuthorizeURL(scopes, state, showDialog, responseType)
Retrieve a URL where the user can give the application permissions.
Parameters
Name | Types | Description |
---|---|---|
scopes | string[] |
The scopes corresponding to the permissions the application needs. |
state | string |
A parameter that you can use to maintain a value between the request and the callback to redirect_uri.It is useful to prevent CSRF exploits. |
showDialog | boolean |
A parameter that you can use to force the user to approve the app on each login rather than being automatically redirected. |
responseType | string |
An optional parameter that you can use to specify the code response based on the authentication type - can be set to 'code' or 'token'. Default 'code' to ensure backwards compatability. |
# refreshAccessToken(callback)
Refresh the access token given that it hasn't expired. Requires that client ID, client secret and refresh token has been set previous to the call.
Parameters
Name | Types | Description |
---|---|---|
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# addToMySavedAlbums(albumIds, callback)
Add an album from the authenticated user's Your Music library.
Parameters
Name | Types | Description |
---|---|---|
albumIds | string[] |
The track IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# addToMySavedShows(showIds, callback)
Add a show from the authenticated user's Your Music library.
Parameters
Name | Types | Description |
---|---|---|
showIds | string[] |
The show IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# addToMySavedTracks(trackIds, callback)
Add a track from the authenticated user's Your Music library.
Parameters
Name | Types | Description |
---|---|---|
trackIds | string[] |
The track IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# addToQueue(uri, options, callback)
Add track or episode to device queue
Parameters
Name | Types | Description |
---|---|---|
uri | string |
uri of the track or episode to add |
options | Object |
Options, being device_id. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# addTracksToPlaylist(playlistId, tracks, options, callback)
Add tracks to a playlist.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID |
tracks | string[] |
URIs of the tracks to add to the playlist. |
options | Object |
Options, position being the only one. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# areFollowingPlaylist(userId, playlistId, User, callback)
Check if users are following a playlist.
Parameters
Name | Types | Description |
---|---|---|
userId | string |
The playlist's owner's user ID |
playlistId | string |
The playlist's ID |
User | String[] |
IDs of the following users |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# changePlaylistDetails(playlistId, options, callback)
Change playlist details.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID |
options | Object |
The possible options, e.g. name, public. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# containsMySavedAlbums(albumIds, callback)
Check if one or more albums is already saved in the current Spotify user’s “Your Music” library.
Parameters
Name | Types | Description |
---|---|---|
albumIds | string[] |
The album IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# containsMySavedShows(showIds, callback)
Check if one or more shows is already saved in the current Spotify user’s “Your Music” library.
Parameters
Name | Types | Description |
---|---|---|
showIds | string[] |
The show IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# containsMySavedTracks(trackIds, callback)
Check if one or more tracks is already saved in the current Spotify user’s “Your Music” library.
Parameters
Name | Types | Description |
---|---|---|
trackIds | string[] |
The track IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# createPlaylist(name, options, callback)
Create a playlist.
Parameters
Name | Types | Description |
---|---|---|
name | string |
The name of the playlist. |
options | Object |
The possible options, being description, collaborative and public. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# e64URI(playlistId, base64URI, callback)
Replace the image used to represent a specific playlist.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID |
base64URI | string |
Base64 encoded JPEG image data, maximum payload size is 256 KB |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# es(options, callback)
Retrieve new releases
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being country, limit and/or offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# followArtists(artistIds, callback)
Add the current user as a follower of one or more artists.
Parameters
Name | Types | Description |
---|---|---|
artistIds | string[] |
The IDs of the artists to be followed. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# followPlaylist(playlistId, options, callback)
Follow a playlist.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID |
options | Object |
The possible options, currently only public. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# followUsers(userIds, callback)
Add the current user as a follower of one or more other Spotify users.
Parameters
Name | Types | Description |
---|---|---|
userIds | string[] |
The IDs of the users to be followed. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getAlbum(albumId, options, callback)
Look up an album.
Parameters
Name | Types | Description |
---|---|---|
albumId | string |
The album's ID. |
options | Object |
The possible options, currently only market. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getAlbums(albumIds, options, callback)
Look up several albums.
Parameters
Name | Types | Description |
---|---|---|
albumIds | string[] |
The IDs of the albums. |
options | Object |
The possible options, currently only market. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getAlbumTracks(albumId, callback)
Get the tracks of an album.
Parameters
Name | Types | Description |
---|---|---|
albumId |
|
the album's ID. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getArtist(artistId, callback)
Look up an artist.
Parameters
Name | Types | Description |
---|---|---|
artistId | string |
The artist's ID. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getArtistAlbums(artistId, callback)
Get an artist's albums.
Parameters
Name | Types | Description |
---|---|---|
artistId | string |
The artist's ID. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getArtistRelatedArtists(artistId, callback)
Get related artists.
Parameters
Name | Types | Description |
---|---|---|
artistId | string |
The artist's ID. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getArtists(artistIds, callback)
Look up several artists.
Parameters
Name | Types | Description |
---|---|---|
artistIds | string[] |
The IDs of the artists. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getArtistTopTracks(artistId, country, callback)
Get an artist's top tracks.
Parameters
Name | Types | Description |
---|---|---|
artistId | string |
The artist's ID. |
country | string |
The country/territory where the tracks are most popular. (format: ISO 3166-1 alpha-2) |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getAudioAnalysisForTrack(trackId, callback)
Get audio analysis for a single track identified by its unique Spotify ID.
Parameters
Name | Types | Description |
---|---|---|
trackId | string |
The track ID |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getAudioFeaturesForTrack(trackId, callback)
Get audio features for a single track identified by its unique Spotify ID.
Parameters
Name | Types | Description |
---|---|---|
trackId | string |
The track ID |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getAudioFeaturesForTracks(trackIds, callback)
Get audio features for multiple tracks identified by their unique Spotify ID.
Parameters
Name | Types | Description |
---|---|---|
trackIds | string[] |
The track IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getAvailableGenreSeeds(callback)
Retrieve a list of available genres seed parameter values for recommendations.
Parameters
Name | Types | Description |
---|---|---|
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getCategories(options, callback)
Retrieve a list of categories used to tag items in Spotify (e.g. in the 'Browse' tab)
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being country, locale, limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getCategory(categoryId, options, callback)
Retrieve a category.
Parameters
Name | Types | Description |
---|---|---|
categoryId | string |
The id of the category to retrieve. |
options | Object |
Options, being country, locale. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getEpisode(episodeId, options, callback)
Look up an episode.
Parameters
Name | Types | Description |
---|---|---|
episodeId | string |
The episode's ID. |
options | Object |
The possible options, currently only market. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getEpisodes(episodeIds, options, callback)
Look up several episodes.
Parameters
Name | Types | Description |
---|---|---|
episodeIds | string[] |
The IDs of the episodes. |
options | Object |
The possible options, currently only market. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getFeaturedPlaylists(options, callback)
Retrieve featured playlists
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being country, locale, timestamp, limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getFollowedArtists(options, callback)
Get the current user's followed artists.
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being after and limit. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMe(callback)
Get information about the user that has signed in (the current user).
Parameters
Name | Types | Description |
---|---|---|
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMyCurrentPlaybackState(options, callback)
Get Information About The User's Current Playback State
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being market and additional_types. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMyCurrentPlayingTrack(options, callback)
Get the Current User's Currently Playing Track.
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being market. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMyDevices(callback)
Get the Current User's Available Devices
Parameters
Name | Types | Description |
---|---|---|
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMyRecentlyPlayedTracks(options, callback)
Get the Current User's Recently Played Tracks
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being type, after, limit, before. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMySavedAlbums(options, callback)
Retrieve the albums that are saved to the authenticated users Your Music library.
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being market, limit, and/or offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMySavedShows(options, callback)
Retrieve the shows that are saved to the authenticated users Your Music library.
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being market, limit, and/or offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMySavedTracks(options, callback)
Retrieve the tracks that are saved to the authenticated users Your Music library.
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being market, limit, and/or offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMyTopArtists(options, callback)
Get the current user's top artists based on calculated affinity.
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being time_range, limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getMyTopTracks(options, callback)
Get the current user's top tracks based on calculated affinity.
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being time_range, limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getPlaylist(playlistId, options, callback)
Get a playlist.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID. |
options | Object |
The options supplied to this request. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getPlaylistsForCategory(categoryId, options, callback)
Retrieve playlists for a category.
Parameters
Name | Types | Description |
---|---|---|
categoryId | string |
The id of the category to retrieve playlists for. |
options | Object |
Options, being country, limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getPlaylistTracks(playlistId, options, callback)
Get tracks in a playlist.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID. |
options | Object |
Optional options, such as fields. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getRecommendations(options, callback)
Create a playlist-style listening experience based on seed artists, tracks and genres.
Parameters
Name | Types | Description |
---|---|---|
options | Object |
The options supplied to this request. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getShow(showId, options, callback)
Get a show.
Parameters
Name | Types | Description |
---|---|---|
showId | string |
The show's ID. |
options | Object |
The possible options, currently only market. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getShowEpisodes(showId, callback)
Get the episodes of an show.
Parameters
Name | Types | Description |
---|---|---|
showId |
|
the show's ID. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getShows(showIds, options, callback)
Look up several shows.
Parameters
Name | Types | Description |
---|---|---|
showIds | string[] |
The IDs of the shows. |
options | Object |
The possible options, currently only market. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getTrack(trackId, options, callback)
Look up a track.
Parameters
Name | Types | Description |
---|---|---|
trackId | string |
The track's ID. |
options | Object |
The possible options, currently only market. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getTracks(trackIds, options, callback)
Look up several tracks.
Parameters
Name | Types | Description |
---|---|---|
trackIds | string[] |
The IDs of the artists. |
options | Object |
The possible options, currently only market. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getUser(userId, callback)
Get information about a user.
Parameters
Name | Types | Description |
---|---|---|
userId |
|
The user ID. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# getUserPlaylists(userId, options, callback)
Get a user's playlists.
Parameters
Name | Types | Description |
---|---|---|
userId | string |
An optional id of the user. If you know the Spotify URI it is easy to find the id (e.g. spotify:user:<here_is_the_id>). If not provided, the id of the user that granted the permissions will be used. |
options | Object |
The options supplied to this request. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# isFollowingArtists(artistIds, callback)
Check to see if the current user is following one or more artists.
Parameters
Name | Types | Description |
---|---|---|
artistIds | string[] |
The IDs of the artists to check if are followed by the current user. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# isFollowingUsers(userIds, callback)
Check to see if the current user is following one or more other Spotify users.
Parameters
Name | Types | Description |
---|---|---|
userIds | string[] |
The IDs of the users to check if are followed by the current user. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# pause(options, callback)
Pauses the Current User's Playback
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being device_id. If left empty will target the user's currently active device. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# play(options, callback)
Starts o Resumes the Current User's Playback
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being device_id, context_uri, offset, uris, position_ms. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# removeFromMySavedAlbums(albumIds, callback)
Remove an album from the authenticated user's Your Music library.
Parameters
Name | Types | Description |
---|---|---|
albumIds | string[] |
The album IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# removeFromMySavedShows(showIds, callback)
Remove an show from the authenticated user's Your Music library.
Parameters
Name | Types | Description |
---|---|---|
showIds | string[] |
The show IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# removeFromMySavedTracks(trackIds, callback)
Remove a track from the authenticated user's Your Music library.
Parameters
Name | Types | Description |
---|---|---|
trackIds | string[] |
The track IDs |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# removeTracksFromPlaylist(playlistId, tracks, options, callback)
Remove tracks from a playlist.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID |
tracks | Object[] |
An array of objects containing a property called uri with the track URI (String), and an optional property called positions (int[]), e.g. { uri : "spotify:track:491rM2JN8KvmV6p0oDDuJT", positions : [0, 15] } |
options | Object |
Options, snapshot_id being the only one. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# removeTracksFromPlaylistByPosition(playlistId, positions, snapshot_id, callback)
Remove tracks from a playlist by position instead of specifying the tracks' URIs.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID |
positions | int[] |
The positions of the tracks in the playlist that should be removed |
snapshot_id | string |
The snapshot ID, or version, of the playlist. Required |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# reorderTracksInPlaylist(playlistId, rangeStart, insertBefore, options, callback)
Reorder tracks in a playlist.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID |
rangeStart | int |
The position of the first track to be reordered. |
insertBefore | int |
The position where the tracks should be inserted. |
options | Object |
Optional parameters, i.e. range_length and snapshot_id. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# replaceTracksInPlaylist(playlistId, uris, callback)
Replace tracks in a playlist.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID |
uris | Object[] |
An array of track URIs (strings) |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# search(query, types, options, callback)
Search for music entities of certain types.
Parameters
Name | Types | Description |
---|---|---|
query | string |
The search query. |
types | string[] |
An array of item types to search across. Valid types are: 'album', 'artist', 'playlist', 'track', 'show', and 'episode'. |
options | Object |
The possible options, e.g. limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# searchAlbums(query, options, callback)
Search for an album.
Parameters
Name | Types | Description |
---|---|---|
query | string |
The search query. |
options | Object |
The possible options, e.g. limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# searchArtists(query, options, callback)
Search for an artist.
Parameters
Name | Types | Description |
---|---|---|
query | string |
The search query. |
options | Object |
The possible options, e.g. limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# searchEpisodes(query, options, callback)
Search for an episode.
Parameters
Name | Types | Description |
---|---|---|
query | string |
The search query. |
options | Object |
The possible options, e.g. limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# searchPlaylists(query, options, callback)
Search for playlists.
Parameters
Name | Types | Description |
---|---|---|
query | string |
The search query. |
options | Object |
The possible options. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# searchShows(query, options, callback)
Search for a show.
Parameters
Name | Types | Description |
---|---|---|
query | string |
The search query. |
options | Object |
The possible options, e.g. limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# searchTracks(query, options, callback)
Search for a track.
Parameters
Name | Types | Description |
---|---|---|
query | string |
The search query. |
options | Object |
The possible options, e.g. limit, offset. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# seek(positionMs, options, callback)
Seeks to the given position in the user’s currently playing track.
Parameters
Name | Types | Description |
---|---|---|
positionMs | number |
The position in milliseconds to seek to. Must be a positive number. |
options | Object |
Options, being device_id. If left empty will target the user's currently active device. |
callback | function(Object,Object) |
An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. |
Returns
Object
Null if a callback is provided, a `Promise` object otherwise
# setRepeat(state, options, callback)
Set Repeat Mode On The Current User's Playback
Parameters
Name | Types | Description |
---|---|---|
state | string |
State (track, context, or off) |
options | Object |
Options, being device_id. If left empty will target the user's currently active device. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# setShuffle(state, options, callback)
Set Shuffle Mode On The Current User's Playback
Parameters
Name | Types | Description |
---|---|---|
state | boolean |
State |
options | Object |
Options, being device_id. If left empty will target the user's currently active device. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# setVolume(volumePercent, options, callback)
Set the volume for the user’s current playback device.
Parameters
Name | Types | Description |
---|---|---|
volumePercent | number |
The volume to set. Must be a value from 0 to 100. |
options | Object |
Options, being device_id. If left empty will target the user's currently active device. |
callback | function(Object,Object) |
An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. |
Returns
Object
Null if a callback is provided, a `Promise` object otherwise
# skipToNext(options, callback)
Skip the Current User's Playback To Next Track
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being device_id. If left empty will target the user's currently active device. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# skipToPrevious(options, callback)
Skip the Current User's Playback To Previous Track
Parameters
Name | Types | Description |
---|---|---|
options | Object |
Options, being device_id. If left empty will target the user's currently active device. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# transferMyPlayback(deviceIds, options, callback)
Transfer a User's Playback
Parameters
Name | Types | Description |
---|---|---|
deviceIds | string[] |
An array containing a device ID on which playback should be started/transferred. (NOTE: The API is currently only supporting a single device ID.) |
options | Object |
Options, the only one being 'play'. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# unfollowArtists(artistIds, callback)
Remove the current user as a follower of one or more artists.
Parameters
Name | Types | Description |
---|---|---|
artistIds | string[] |
The IDs of the artists to be unfollowed. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# unfollowPlaylist(playlistId, callback)
Unfollow a playlist.
Parameters
Name | Types | Description |
---|---|---|
playlistId | string |
The playlist's ID |
callback | requestCallback |
Optional callback method to be called instead of the promise. |
# unfollowUsers(userIds, callback)
Remove the current user as a follower of one or more other Spotify users.
Parameters
Name | Types | Description |
---|---|---|
userIds | string[] |
The IDs of the users to be unfollowed. |
callback | requestCallback |
Optional callback method to be called instead of the promise. |