- RETURN_ASSOC
- RETURN_OBJECT
SpotifyWebAPI\SpotifyWebAPI::__construct(\SpotifyWebAPI\Request $request)
Constructor
Set up Request object.
$request\SpotifyWebAPI\Request - Optional. The Request object to use.
boolean SpotifyWebAPI\SpotifyWebAPI::addMyAlbums(string|array $albums)
Add albums to the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/library/save-albums-user/
$albumsstring|array - ID(s) or Spotify URI(s) of the album(s) to add.
- boolean Whether the albums was successfully added.
boolean SpotifyWebAPI\SpotifyWebAPI::addMyTracks(string|array $tracks)
Add tracks to the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/library/save-tracks-user/
$tracksstring|array - ID(s) or Spotify URI(s) of the track(s) to add.
- boolean Whether the tracks was successfully added.
boolean SpotifyWebAPI\SpotifyWebAPI::addPlaylistTracks(string $playlistId, string|array $tracks, array|object $options)
Add tracks to a playlist.
https://developer.spotify.com/documentation/web-api/reference/playlists/add-tracks-to-playlist/
$playlistIdstring - ID of the playlist to add tracks to.$tracksstring|array - ID(s) or Spotify URI(s) of the track(s) to add.$optionsarray|object - Optional. Options for the new tracks.- int position Optional. Zero-based track position in playlist. Tracks will be appened if omitted or false.
- boolean Whether the tracks was successfully added.
_Deprecated: _
boolean SpotifyWebAPI\SpotifyWebAPI::addUserPlaylistTracks(string $userId, string $playlistId, string|array $tracks, array|object $options)
$userIdstring - ID of the user who owns the playlist.$playlistIdstring - ID of the playlist to add tracks to.$tracksstring|array - ID(s) or Spotify URI(s) of the track(s) to add.$optionsarray|object - Optional. Options for the new tracks.- int position Optional. Zero-based track position in playlist. Tracks will be appened if omitted or false.
- boolean Whether the tracks was successfully added.
boolean SpotifyWebAPI\SpotifyWebAPI::changeMyDevice(array|object $options)
Change the current user's playback device.
https://developer.spotify.com/documentation/web-api/reference/player/transfer-a-users-playback/
$optionsarray|object - Options for the playback transfer.- string|array device_ids Required. ID of the device to switch to.
- bool play Optional. Whether to start playing on the new device
- boolean Whether the playback device was successfully changed.
boolean SpotifyWebAPI\SpotifyWebAPI::changeVolume(array|object $options)
Change playback volume for the current user.
https://developer.spotify.com/documentation/web-api/reference/player/set-volume-for-users-playback/
$optionsarray|object - Optional. Options for the playback volume.- int volume_percent Required. The volume to set.
- string device_id Optional. ID of the device to target.
- boolean Whether the playback volume was successfully changed.
array|object SpotifyWebAPI\SpotifyWebAPI::createPlaylist(array|object $options)
Create a new playlist.
https://developer.spotify.com/documentation/web-api/reference/playlists/create-playlist/
$optionsarray|object - Options for the new playlist.- string name Required. Name of the playlist.
- bool public Optional. Whether the playlist should be public or not.
- array|object The new playlist. Type is controlled by
SpotifyWebAPI::setReturnType().
_Deprecated: _
array|object SpotifyWebAPI\SpotifyWebAPI::createUserPlaylist(string $userId, array|object $options)
$userIdstring - ID or Spotify URI of the user to create the playlist for.$optionsarray|object - Options for the new playlist.- string name Required. Name of the playlist.
- bool public Optional. Whether the playlist should be public or not.
- array|object The new playlist. Type is controlled by
SpotifyWebAPI::setReturnType().
array SpotifyWebAPI\SpotifyWebAPI::currentUserFollows(string $type, string|array $ids)
Check to see if the current user is following one or more artists or other Spotify users.
https://developer.spotify.com/documentation/web-api/reference/follow/check-current-user-follows/
$typestring - The type to check: either 'artist' or 'user'.$idsstring|array - ID(s) or Spotify URI(s) of the user(s) or artist(s) to check for.
- array Whether each user or artist is followed.
boolean SpotifyWebAPI\SpotifyWebAPI::deleteMyAlbums(string|array $albums)
Delete albums from current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/library/remove-albums-user/
$albumsstring|array - ID(s) or Spotify URI(s) of the album(s) to delete.
- boolean Whether the albums was successfully deleted.
boolean SpotifyWebAPI\SpotifyWebAPI::deleteMyTracks(string|array $tracks)
Delete tracks from current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/library/remove-tracks-user/
$tracksstring|array - ID(s) or Spotify URI(s) of the track(s) to delete.
- boolean Whether the tracks was successfully deleted.
string|boolean SpotifyWebAPI\SpotifyWebAPI::deletePlaylistTracks(string $playlistId, array $tracks, string $snapshotId)
Delete tracks from a playlist and retrieve a new snapshot ID.
https://developer.spotify.com/documentation/web-api/reference/playlists/remove-tracks-playlist/
-
$playlistIdstring - ID or Spotify URI of the playlist to delete tracks from. -
$tracksarray - An array with the key "tracks" containing arrays or objects with tracks to delete. Or an array with the key "positions" containing integer positions of the tracks to delete. For legacy reasons, the "tracks" key can be omitted but its use is deprecated. If the "tracks" key is used, the following fields are also available:- string id Required. Track ID or Spotify URI.
- int|array positions Optional. The track's position(s) in the playlist.
-
$snapshotIdstring - Required when $tracks['positions'] is used, optional otherwise. The playlist's snapshot ID.
- string|boolean A new snapshot ID or false if the tracks weren't successfully deleted.
_Deprecated: _
string|boolean SpotifyWebAPI\SpotifyWebAPI::deleteUserPlaylistTracks(string $userId, string $playlistId, array $tracks, string $snapshotId)
-
$userIdstring - ID or Spotify URI of the user who owns the playlist. -
$playlistIdstring - ID or Spotify URI of the playlist to delete tracks from. -
$tracksarray - An array with the key "tracks" containing arrays or objects with tracks to delete. Or an array with the key "positions" containing integer positions of the tracks to delete. For legacy reasons, the "tracks" key can be omitted but its use is deprecated. If the "tracks" key is used, the following fields are also available:- string id Required. Track ID or Spotify URI.
- int|array positions Optional. The track's position(s) in the playlist.
-
$snapshotIdstring - Required when $tracks['positions'] is used, optional otherwise. The playlist's snapshot ID.
- string|boolean A new snapshot ID or false if the tracks weren't successfully deleted.
boolean SpotifyWebAPI\SpotifyWebAPI::followArtistsOrUsers(string $type, string|array $ids)
Add the current user as a follower of one or more artists or other Spotify users.
https://developer.spotify.com/documentation/web-api/reference/follow/follow-artists-users/
$typestring - The type to check: either 'artist' or 'user'.$idsstring|array - ID(s) or Spotify URI(s) of the user(s) or artist(s) to follow.
- boolean Whether the artist or user was successfully followed.
_Deprecated: _
boolean SpotifyWebAPI\SpotifyWebAPI::followPlaylist(string $userId, string $playlistId, array|object $options)
$userIdstring - ID or Spotify URI of the user who owns the playlist.$playlistIdstring - ID or Spotify URI of the playlist to follow.$optionsarray|object - Optional. Options for the followed playlist.- bool public Optional. Whether the playlist should be followed publicly or not.
- boolean Whether the playlist was successfully followed.
boolean SpotifyWebAPI\SpotifyWebAPI::followPlaylistForCurrentUser(string $playlistId, array|object $options)
Add the current user as a follower of a playlist.
https://developer.spotify.com/documentation/web-api/reference/follow/follow-playlist/
$playlistIdstring - ID or Spotify URI of the playlist to follow.$optionsarray|object - Optional. Options for the followed playlist.- bool public Optional. Whether the playlist should be followed publicly or not.
- boolean Whether the playlist was successfully followed.
array|object SpotifyWebAPI\SpotifyWebAPI::getAlbum(string $albumId)
Get a album.
https://developer.spotify.com/documentation/web-api/reference/albums/get-album/
$albumIdstring - ID or Spotify URI of the album.
- array|object The requested album. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getAlbums(array $albumIds, array|object $options)
Get multiple albums.
https://developer.spotify.com/documentation/web-api/reference/albums/get-several-albums/
$albumIdsarray - IDs or Spotify URIs of the albums.$optionsarray|object - Optional. Options for the albums.- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The requested albums. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getAlbumTracks(string $albumId, array|object $options)
Get an album's tracks.
https://developer.spotify.com/documentation/web-api/reference/albums/get-albums-tracks/
$albumIdstring - ID or Spotify URI of the album.$optionsarray|object - Optional. Options for the tracks.- int limit Optional. Limit the number of tracks.
- int offset Optional. Number of tracks to skip.
- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The requested album tracks. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getArtist(string $artistId)
Get an artist.
https://developer.spotify.com/documentation/web-api/reference/artists/get-artist/
$artistIdstring - ID or Spotify URI of the artist.
- array|object The requested artist. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getArtists(array $artistIds)
Get multiple artists.
https://developer.spotify.com/documentation/web-api/reference/artists/get-several-artists/
$artistIdsarray - IDs or Spotify URIs of the artists.
- array|object The requested artists. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getArtistRelatedArtists(string $artistId)
Get an artist's related artists.
https://developer.spotify.com/documentation/web-api/reference/artists/get-related-artists/
$artistIdstring - ID or Spotify URI of the artist.
- array|object The artist's related artists. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getArtistAlbums(string $artistId, array|object $options)
Get an artist's albums.
https://developer.spotify.com/documentation/web-api/reference/artists/get-artists-albums/
$artistIdstring - ID or Spotify URI of the artist.$optionsarray|object - Optional. Options for the albums.- string|array album_type Optional. Album type(s) to return. If omitted, all album types will be returned.
- string market Optional. Limit the results to items that are playable in this market, for example SE.
- int limit Optional. Limit the number of albums.
- int offset Optional. Number of albums to skip.
- array|object The artist's albums. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getArtistTopTracks(string $artistId, array|object $options)
Get an artist's top tracks in a country.
https://developer.spotify.com/documentation/web-api/reference/artists/get-artists-top-tracks/
$artistIdstring - ID or Spotify URI of the artist.$optionsarray|object - Options for the tracks.- string $country Required. An ISO 3166-1 alpha-2 country code specifying the country to get the top tracks for.
- array|object The artist's top tracks. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getAudioFeatures(array $trackIds)
Get track audio features.
https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-audio-features/
$trackIdsarray - IDs or Spotify URIs of the tracks.
- array|object The tracks' audio features. Type is controlled by
SpotifyWebAPI::setReturnType().
object SpotifyWebAPI\SpotifyWebAPI::getAudioAnalysis(string $trackId)
Get audio analysis for track.
https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-analysis/
$trackIdstring - ID or Spotify URI of the track.
- object The track's audio analysis. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getCategoriesList(array|object $options)
Get a list of categories used to tag items in Spotify (on, for example, the Spotify player’s "Browse" tab).
https://developer.spotify.com/documentation/web-api/reference/browse/get-list-categories/
$optionsarray|object - Optional. Options for the categories.- string locale Optional. Language to show categories in, for example sv_SE.
- string country Optional. An ISO 3166-1 alpha-2 country code. Show categories from this country.
- int limit Optional. Limit the number of categories.
- int offset Optional. Number of categories to skip.
- array|object The list of categories. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getCategory(string $categoryId, array|object $options)
Get a single category used to tag items in Spotify (on, for example, the Spotify player’s "Browse" tab).
https://developer.spotify.com/documentation/web-api/reference/browse/get-category/
$categoryIdstring - The Spotify ID of the category.$optionsarray|object - Optional. Options for the category.- string locale Optional. Language to show category in, for example sv_SE.
- string country Optional. An ISO 3166-1 alpha-2 country code. Show category from this country.
- array|object The category. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getCategoryPlaylists(string $categoryId, array|object $options)
Get a list of Spotify playlists tagged with a particular category.
https://developer.spotify.com/documentation/web-api/reference/browse/get-categorys-playlists/
$categoryIdstring - The Spotify ID of the category.$optionsarray|object - Optional. Options for the category's playlists.- string country Optional. An ISO 3166-1 alpha-2 country code. Show category playlists from this country.
- int limit Optional. Limit the number of playlists.
- int offset Optional. Number of playlists to skip.
- array|object The list of playlists. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getFeaturedPlaylists(array|object $options)
Get Spotify featured playlists.
https://developer.spotify.com/documentation/web-api/reference/browse/get-list-featured-playlists/
$optionsarray|object - Optional. Options for the playlists.- string locale Optional. Language to show playlists in, for example sv_SE.
- string country Optional. An ISO 3166-1 alpha-2 country code. Show playlists from this country.
- string timestamp Optional. A ISO 8601 timestamp. Show playlists relevant to this date and time.
- int limit Optional. Limit the number of playlists.
- int offset Optional. Number of playlists to skip.
- array|object The featured playlists. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getGenreSeeds()
Get a list of possible seed genres.
https://developer.spotify.com/documentation/web-api/reference/browse/get-recommendations/
- array|object All possible seed genres. Type is controlled by
SpotifyWebAPI::setReturnType().
array SpotifyWebAPI\SpotifyWebAPI::getLastResponse()
Get the latest full response from the Spotify API.
- array Response data.
- array|object body The response body. Type is controlled by
SpotifyWebAPI::setReturnType(). - array headers Response headers.
- int status HTTP status code.
- string url The requested URL.
- array|object body The response body. Type is controlled by
array|object SpotifyWebAPI\SpotifyWebAPI::getMyCurrentTrack(array|object $options)
Get the current user’s currently playing track.
https://developer.spotify.com/documentation/web-api/reference/player/get-the-users-currently-playing-track/
$optionsarray|object - Optional. Options for the track.- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The user's currently playing track. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getMyDevices()
Get the current user’s devices.
https://developer.spotify.com/documentation/web-api/reference/player/get-a-users-available-devices/
- array|object The user's devices. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getMyCurrentPlaybackInfo(array|object $options)
Get the current user’s current playback information.
https://developer.spotify.com/documentation/web-api/reference/player/get-information-about-the-users-current-playback/
$optionsarray|object - Optional. Options for the info.- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The user's playback information. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getMyPlaylists(array|object $options)
Get the current user’s playlists.
https://developer.spotify.com/documentation/web-api/reference/playlists/get-a-list-of-current-users-playlists/
$optionsarray|object - Optional. Options for the playlists.- int limit Optional. Limit the number of playlists.
- int offset Optional. Number of playlists to skip.
- array|object The user's playlists. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getMyRecentTracks(array|object $options)
Get the current user’s recently played tracks.
https://developer.spotify.com/documentation/web-api/reference/player/get-recently-played/
$optionsarray|object - Optional. Options for the tracks.- int limit Optional. Number of tracks to return.
- string after Optional. Unix timestamp in ms (13 digits). Returns all items after this position.
- string before Optional. Unix timestamp in ms (13 digits). Returns all items before this position.
- array|object The most recently played tracks. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getMySavedAlbums(array|object $options)
Get the current user’s saved albums.
https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-albums/
$optionsarray|object - Optional. Options for the albums.- int limit Optional. Number of albums to return.
- int offset Optional. Number of albums to skip.
- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The user's saved albums. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getMySavedTracks(array|object $options)
Get the current user’s saved tracks.
https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-tracks/
$optionsarray|object - Optional. Options for the tracks.- int limit Optional. Limit the number of tracks.
- int offset Optional. Number of tracks to skip.
- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The user's saved tracks. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getMyTop(string $type, $options)
Get the current user's top tracks or artists.
https://developer.spotify.com/documentation/web-api/reference/personalization/get-users-top-artists-and-tracks/
$typestring - The type of entity to fetch.$optionsmixed
- array|object A list of the requested top entity. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getNewReleases(array|object $options)
Get new releases.
https://developer.spotify.com/documentation/web-api/reference/browse/get-list-new-releases/
$optionsarray|object - Optional. Options for the items.- string country Optional. An ISO 3166-1 alpha-2 country code. Show items relevant to this country.
- int limit Optional. Limit the number of items.
- int offset Optional. Number of items to skip.
- array|object The new releases. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getPlaylist(string $playlistId, array|object $options)
Get a specific playlist.
https://developer.spotify.com/documentation/web-api/reference/playlists/get-playlist/
$playlistIdstring - ID or Spotify URI of the playlist.$optionsarray|object - Optional. Options for the playlist.- string|array fields Optional. A list of fields to return. See Spotify docs for more info.
- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The user's playlist. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getPlaylistTracks(string $playlistId, array|object $options)
Get the tracks in a playlist.
https://developer.spotify.com/documentation/web-api/reference/playlists/get-playlists-tracks/
$playlistIdstring - ID or Spotify URI of the playlist.$optionsarray|object - Optional. Options for the tracks.- string|array fields Optional. A list of fields to return. See Spotify docs for more info.
- int limit Optional. Limit the number of tracks.
- int offset Optional. Number of tracks to skip.
- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The tracks in the playlist. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getRecommendations(array|object $options)
Get recommendations based on artists, tracks, or genres.
https://developer.spotify.com/documentation/web-api/reference/browse/get-recommendations/
$optionsarray|object - Optional. Options for the recommendations.- int limit Optional. Limit the number of recommendations.
- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- mixed max_* Optional. Max value for one of the tunable track attributes.
- mixed min_* Optional. Min value for one of the tunable track attributes.
- array seed_artists Artist IDs to seed by.
- array seed_genres Genres to seed by. Call SpotifyWebAPI::getGenreSeeds() for a complete list.
- array seed_tracks Track IDs to seed by.
- mixed target_* Optional. Target value for one of the tunable track attributes.
- array|object The requested recommendations. Type is controlled by
SpotifyWebAPI::setReturnType().
string SpotifyWebAPI\SpotifyWebAPI::getReturnType()
Get a value indicating the response body type.
- string A value indicating if the response body is an object or associative array.
\SpotifyWebAPI\Request SpotifyWebAPI\SpotifyWebAPI::getRequest()
Get the Request object in use.
- \SpotifyWebAPI\Request The Request object in use.
array|object SpotifyWebAPI\SpotifyWebAPI::getTrack(string $trackId, array|object $options)
Get a track.
https://developer.spotify.com/documentation/web-api/reference/tracks/get-track/
$trackIdstring - ID or Spotify URI of the track.$optionsarray|object - Optional. Options for the track.- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The requested track. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getTracks(array $trackIds, array|object $options)
Get multiple tracks.
https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-tracks/
$trackIdsarray - IDs or Spotify URIs of the tracks.$optionsarray|object - Optional. Options for the albums.- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The requested tracks. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getUser(string $userId)
Get a user.
https://developer.spotify.com/documentation/web-api/reference/users-profile/get-users-profile/
$userIdstring - ID or Spotify URI of the user.
- array|object The requested user. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getUserFollowedArtists(array|object $options)
Get the artists followed by the current user.
https://developer.spotify.com/documentation/web-api/reference/follow/get-followed/
$optionsarray|object - Optional. Options for the artists.- int limit Optional. Limit the number of artists returned.
- string after Optional. The last artist ID retrieved from the previous request.
- array|object A list of artists. Type is controlled by
SpotifyWebAPI::setReturnType().
_Deprecated: _
array|object SpotifyWebAPI\SpotifyWebAPI::getUserPlaylist(string $userId, string $playlistId, array|object $options)
$userIdstring - ID or Spotify URI of the user.$playlistIdstring - ID or Spotify URI of the playlist.$optionsarray|object - Optional. Options for the playlist.- string|array fields Optional. A list of fields to return. See Spotify docs for more info.
- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The user's playlist. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::getUserPlaylists(string $userId, array|object $options)
Get a user's playlists.
https://developer.spotify.com/documentation/web-api/reference/playlists/get-list-users-playlists/
$userIdstring - ID or Spotify URI of the user.$optionsarray|object - Optional. Options for the tracks.- int limit Optional. Limit the number of tracks.
- int offset Optional. Number of tracks to skip.
- array|object The user's playlists. Type is controlled by
SpotifyWebAPI::setReturnType().
_Deprecated: _
array|object SpotifyWebAPI\SpotifyWebAPI::getUserPlaylistTracks(string $userId, string $playlistId, array|object $options)
$userIdstring - ID or Spotify URI of the user.$playlistIdstring - ID or Spotify URI of the playlist.$optionsarray|object - Optional. Options for the tracks.- string|array fields Optional. A list of fields to return. See Spotify docs for more info.
- int limit Optional. Limit the number of tracks.
- int offset Optional. Number of tracks to skip.
- string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The tracks in the playlist. Type is controlled by
SpotifyWebAPI::setReturnType().
array|object SpotifyWebAPI\SpotifyWebAPI::me()
Get the currently authenticated user.
https://developer.spotify.com/documentation/web-api/reference/users-profile/get-current-users-profile/
- array|object The currently authenticated user. Type is controlled by
SpotifyWebAPI::setReturnType().
array SpotifyWebAPI\SpotifyWebAPI::myAlbumsContains(string|array $albums)
Check if albums are saved in the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-albums/
$albumsstring|array - ID(s) or Spotify URI(s) of the album(s) to check for.
- array Whether each album is saved.
array SpotifyWebAPI\SpotifyWebAPI::myTracksContains(string|array $tracks)
Check if tracks are saved in the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-tracks/
$tracksstring|array - ID(s) or Spotify URI(s) of the track(s) to check for.
- array Whether each track is saved.
boolean SpotifyWebAPI\SpotifyWebAPI::next(string $deviceId)
Play the next track in the current users's queue.
https://developer.spotify.com/documentation/web-api/reference/player/skip-users-playback-to-next-track/
$deviceIdstring - Optional. ID of the device to target.
- boolean Whether the track was successfully skipped.
boolean SpotifyWebAPI\SpotifyWebAPI::pause(string $deviceId)
Pause playback for the current user.
https://developer.spotify.com/documentation/web-api/reference/player/pause-a-users-playback/
$deviceIdstring - Optional. ID of the device to pause on.
- boolean Whether the playback was successfully paused.
boolean SpotifyWebAPI\SpotifyWebAPI::play(string $deviceId, array|object $options)
Start playback for the current user.
https://developer.spotify.com/documentation/web-api/reference/player/start-a-users-playback/
$deviceIdstring - Optional. ID of the device to play on.$optionsarray|object - Optional. Options for the playback.- string context_uri Optional. Spotify URI of the context to play, for example an album.
- array uris Optional. Spotify track URIs to play.
- object offset Optional. Indicates from where in the context playback should start.
- boolean Whether the playback was successfully started.
boolean SpotifyWebAPI\SpotifyWebAPI::previous(string $deviceId)
Play the previous track in the current users's queue.
https://developer.spotify.com/documentation/web-api/reference/player/skip-users-playback-to-previous-track/
$deviceIdstring - Optional. ID of the device to target.
- boolean Whether the track was successfully skipped.
string|boolean SpotifyWebAPI\SpotifyWebAPI::reorderPlaylistTracks(string $playlistId, array|object $options)
Reorder the tracks in a playlist.
https://developer.spotify.com/documentation/web-api/reference/playlists/reorder-playlists-tracks/
$playlistIdstring - ID or Spotify URI of the playlist.$optionsarray|object - Options for the new tracks.- int range_start Required. Position of the first track to be reordered.
- int range_length Optional. The amount of tracks to be reordered.
- int insert_before Required. Position where the tracks should be inserted.
- string snapshot_id Optional. The playlist's snapshot ID.
- string|boolean A new snapshot ID or false if the tracks weren't successfully reordered.
_Deprecated: _
string|boolean SpotifyWebAPI\SpotifyWebAPI::reorderUserPlaylistTracks(string $userId, string $playlistId, array|object $options)
$userIdstring - ID or Spotify URI of the user.$playlistIdstring - ID or Spotify URI of the playlist.$optionsarray|object - Options for the new tracks.- int range_start Required. Position of the first track to be reordered.
- int range_length Optional. The amount of tracks to be reordered.
- int insert_before Required. Position where the tracks should be inserted.
- string snapshot_id Optional. The playlist's snapshot ID.
- string|boolean A new snapshot ID or false if the tracks weren't successfully reordered.
boolean SpotifyWebAPI\SpotifyWebAPI::repeat(array|object $options)
Set repeat mode for the current user’s playback.
https://developer.spotify.com/documentation/web-api/reference/player/set-repeat-mode-on-users-playback/
$optionsarray|object - Optional. Options for the playback repeat mode.- string state Required. The repeat mode. See Spotify docs for possible values.
- string device_id Optional. ID of the device to target.
- boolean Whether the playback repeat mode was successfully changed.
boolean SpotifyWebAPI\SpotifyWebAPI::replacePlaylistTracks(string $playlistId, string|array $tracks)
Replace all tracks in a playlist with new ones.
https://developer.spotify.com/documentation/web-api/reference/playlists/replace-playlists-tracks/
$playlistIdstring - ID or Spotify URI of the playlist.$tracksstring|array - ID(s) or Spotify URI(s) of the track(s) to add.
- boolean Whether the tracks was successfully replaced.
_Deprecated: _
boolean SpotifyWebAPI\SpotifyWebAPI::replaceUserPlaylistTracks(string $userId, string $playlistId, string|array $tracks)
$userIdstring - ID or Spotify URI of the user.$playlistIdstring - ID or Spotify URI of the playlist.$tracksstring|array - ID(s) or Spotify URI(s) of the track(s) to add.
- boolean Whether the tracks was successfully replaced.
array|object SpotifyWebAPI\SpotifyWebAPI::search(string $query, string|array $type, array|object $options)
Search for an item.
https://developer.spotify.com/documentation/web-api/reference/search/search/
$querystring - The term to search for.$typestring|array - The type of item to search for.$optionsarray|object - Optional. Options for the search.- string market Optional. Limit the results to items that are playable in this market, for example SE.
- int limit Optional. Limit the number of items.
- int offset Optional. Number of items to skip.
- array|object The search results. Type is controlled by
SpotifyWebAPI::setReturnType().
boolean SpotifyWebAPI\SpotifyWebAPI::seek(array|object $options)
Change playback position for the current user.
https://developer.spotify.com/documentation/web-api/reference/player/seek-to-position-in-currently-playing-track/
$optionsarray|object - Optional. Options for the playback seeking.- string position_ms Required. The position in milliseconds to seek to.
- string device_id Optional. ID of the device to target.
- boolean Whether the playback position was successfully changed.
void SpotifyWebAPI\SpotifyWebAPI::setAccessToken(string $accessToken)
Set the access token to use.
$accessTokenstring - The access token.
- void
void SpotifyWebAPI\SpotifyWebAPI::setReturnType(string $returnType)
Set the return type for the response body.
$returnTypestring - One of the SpotifyWebAPI::RETURN_* constants.
- void
boolean SpotifyWebAPI\SpotifyWebAPI::shuffle(array|object $options)
Set shuffle mode for the current user’s playback.
https://developer.spotify.com/documentation/web-api/reference/player/toggle-shuffle-for-users-playback/
$optionsarray|object - Optional. Options for the playback shuffle mode.- bool state Required. The shuffle mode. See Spotify docs for possible values.
- string device_id Optional. ID of the device to target.
- boolean Whether the playback shuffle mode was successfully changed.
boolean SpotifyWebAPI\SpotifyWebAPI::unfollowArtistsOrUsers(string $type, string|array $ids)
Remove the current user as a follower of one or more artists or other Spotify users.
https://developer.spotify.com/documentation/web-api/reference/follow/unfollow-artists-users/
$typestring - The type to check: either 'artist' or 'user'.$idsstring|array - ID(s) or Spotify URI(s) of the user(s) or artist(s) to unfollow.
- boolean Whether the artist(s) or user(s) were successfully unfollowed.
_Deprecated: _
boolean SpotifyWebAPI\SpotifyWebAPI::unfollowPlaylist(string $userId, string $playlistId)
$userIdstring - ID or Spotify URI of the user who owns the playlist.$playlistIdstring - ID or Spotify URI of the playlist to unfollow
- boolean Whether the playlist was successfully unfollowed.
boolean SpotifyWebAPI\SpotifyWebAPI::unfollowPlaylistForCurrentUser(string $playlistId)
Remove the current user as a follower of a playlist.
https://developer.spotify.com/documentation/web-api/reference/follow/unfollow-playlist/
$playlistIdstring - ID or Spotify URI of the playlist to unfollow
- boolean Whether the playlist was successfully unfollowed.
boolean SpotifyWebAPI\SpotifyWebAPI::updatePlaylist(string $playlistId, array|object $options)
Update the details of a playlist.
https://developer.spotify.com/documentation/web-api/reference/playlists/change-playlist-details/
$playlistIdstring - ID or Spotify URI of the playlist to update.$optionsarray|object - Options for the playlist.- collaborative bool Optional. Whether the playlist should be collaborative or not.
- description string Optional. Description of the playlist.
- name string Optional. Name of the playlist.
- public bool Optional. Whether the playlist should be public or not.
- boolean Whether the playlist was successfully updated.
boolean SpotifyWebAPI\SpotifyWebAPI::updateUserPlaylist(string $userId, string $playlistId, array|object $options)
Update the details of a user's playlist.
https://developer.spotify.com/documentation/web-api/reference/playlists/change-playlist-details/
$userIdstring - ID or Spotify URI of the user who owns the playlist.$playlistIdstring - ID or Spotify URI of the playlist to update.$optionsarray|object - Options for the playlist.- collaborative bool Optional. Whether the playlist should be collaborative or not.
- description string Optional. Description of the playlist.
- name string Optional. Name of the playlist.
- public bool Optional. Whether the playlist should be public or not.
- boolean Whether the playlist was successfully updated.
boolean SpotifyWebAPI\SpotifyWebAPI::updatePlaylistImage(string $playlistId, $imageData)
Update the image of a playlist.
https://developer.spotify.com/documentation/web-api/reference/playlists/upload-custom-playlist-cover/
$playlistIdstring - ID or Spotify URI of the playlist to update.$imageDatamixed
- boolean Whether the playlist was successfully updated.
_Deprecated: _
boolean SpotifyWebAPI\SpotifyWebAPI::updateUserPlaylistImage(string $userId, string $playlistId, $imageData)
$userIdstring - ID or Spotify URI of the user who owns the playlist.$playlistIdstring - ID or Spotify URI of the playlist to update.$imageDatamixed
- boolean Whether the playlist was successfully updated.
_Deprecated: _
array SpotifyWebAPI\SpotifyWebAPI::userFollowsPlaylist(string $userId, string $playlistId, array|object $options)
$userIdstring - User ID or Spotify URI of the playlist owner.$playlistIdstring - ID or Spotify URI of the playlist.$optionsarray|object - Options for the check.- ids string|array Required. ID(s) or Spotify URI(s) of the user(s) to check for.
- array Whether each user is following the playlist.
array SpotifyWebAPI\SpotifyWebAPI::usersFollowPlaylist(string $playlistId, array|object $options)
Check if a set of users are following a playlist.
https://developer.spotify.com/documentation/web-api/reference/follow/check-user-following-playlist/
$playlistIdstring - ID or Spotify URI of the playlist.$optionsarray|object - Options for the check.- ids string|array Required. ID(s) or Spotify URI(s) of the user(s) to check for.
- array Whether each user is following the playlist.