Endpoints
Here we list out all the endpoints for given portions of the API
Certain endpoints require special permissions that would need elevated authentication methods
Albums
Album endpoints are somewhat limited but can be combined with other calls to become very powerful
Spotify.album_get_contains
— Methodalbum_get_contains(album_ids)
Summary: Check if one or more albums is already saved in the current Spotify user's 'Your Music' library.
Arguments
ids
: A comma-separated list of the Spotify album IDs
Example
julia> album_get_contains(["2O9mD7oKwBnhQZQUAJM6GM", "3eLvDNfWAMpytqIp073FEc"])[1]
2-element JSON3.Array{Bool, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
0
0
Spotify.album_get_multiple
— Methodalbum_get_multiple(album_ids; market = "")
Summary: Get Spotify catalog information for multiple albums identified by their Spotify IDs.
Arguments
album_ids
: A comma-separated list of the Spotify IDs for the albums. Maximum: 20 IDs.
Optional keywords
market
: An ISO 3166-1 alpha-2 country code. Default is set to "US".
Example
julia> album_get_multiple(["2O9mD7oKwBnhQZQUAJM6GM", "3eLvDNfWAMpytqIp073FEc"])[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:albums => JSON3.Object[{…
More formally,
julia> album_get_multiple(SpAlbumId.(["5XgEM5g3xWEwL4Zr6UjoLo", "2rpT0freJsmUmmPluVWqg5"]))[1]
Spotify.album_get_saved
— Methodalbum_get_saved(;limit = 20, market = "", offset = 0)
Summary: Get a list of the albums saved in the current Spotify user's 'Your Music' library.
Optional keywords
limit
: Maximum number of items to return, default is set to 20market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only episodes that are available in that market will be returned. Default is set to "US".offset
: Index of the first item to return, default is set to 0
Example
julia> album_get_saved()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:href => "https://api.spotify.com/v1/me/albums?offset=0&limit=20"
:items => JSON3.Object[{…
:limit => 20
:next => "https://api.spotify.com/v1/me/albums?offset=20&limit=20"
:offset => 0
:previous => nothing
:total => 33
Spotify.album_get_single
— Methodalbum_get_single(album_id; market = "")
**Summary**: Get Spotify catalog information for a single album.
# Arguments
- `album_id` : The Spotify ID for the album.
# Optional keywords
- `market` : An ISO 3166-1 alpha-2 country code.
# Example
```julia-repl
julia> album_get_single("2O9mD7oKwBnhQZQUAJM6GM")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 19 entries:
:album_type => "album"
:artists => JSON3.Object[{…
:available_markets => ["AD", "AE", "AR", "AT", "AU", "BD", "BE", "BG", "BH", "BO" … "SK", "SV", "TH", "TN", "T…
:copyrights => JSON3.Object[{…
:external_ids => {…
:external_urls => {…
:genres => Union{}[]
:href => "https://api.spotify.com/v1/albums/2O9mD7oKwBnhQZQUAJM6GM"
:id => "2O9mD7oKwBnhQZQUAJM6GM"
:images => JSON3.Object[{…
:label => "OOO Universal Music"
:name => "200 По встречной"
:popularity => 47
:release_date => "2002-01-01"
:release_date_precision => "day"
:total_tracks => 12
:tracks => {…
:type => "album"
:uri => "spotify:album:2O9mD7oKwBnhQZQUAJM6GM"
```
Spotify.album_get_tracks
— Methodalbum_get_tracks(album_id; limit = 20, offset = 0, market = "")
Summary: Get Spotify catalog information about an album's tracks. Optional parameters can be used to limit the number of tracks returned.
Arguments
album_id
: The Spotify ID for the album
Optional keywords
limit
: The maximum number of tracks to return. Default is set to 20.offset
: The index of the first track to return. Default is 0.market
: An ISO 3166-1 alpha-2 country code. Default is set to "US".
Example
julia> album_get_tracks("2O9mD7oKwBnhQZQUAJM6GM")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:href => "https://api.spotify.com/v1/albums/2O9mD7oKwBnhQZQUAJM6GM/tracks?offset=0&limit=20"
:items => JSON3.Object[{…
:limit => 20
:next => nothing
:offset => 0
:previous => nothing
:total => 12
Spotify.album_remove_from_library
— Methodalbum_remove_from_library(album_ids)
Summary: Remove one or more albums for the current user's 'Your Music' library.
Arguments
album_ids
Required: A comma-separated list of the Spotify IDs. Maximum 50.
Example
julia> album_remove_from_library(["2O9mD7oKwBnhQZQUAJM6GM", "3eLvDNfWAMpytqIp073FEc"])[1]
{}
Spotify.album_save_library
— Methodalbum_save_library(album_ids)
** Summary**: Save one or more albums to the current user's 'Your Music' library.
Arguments
album_ids
Required: A comma-separated list of Spotify IDs. Maximum 50.
Example
julia> album_save_library(["2O9mD7oKwBnhQZQUAJM6GM", "3eLvDNfWAMpytqIp073FEc"])[1]
{}
Spotify.artist_get_albums
— Methodartist_get_albums(artist_id; include_groups = "album", country = "", limit = 20, offset = 0)
Summary: Get Spotify catalog information about an artist's albums.
Arguments
artist_id
: The Spotify ID of the artist
Optional keyword arguments
include_groups
: A comma-separated list of keywords that will be used to filter the response. If not supplied, all album types will be returned. Valid values are: *album
*single
*compilation
*appears_on
country
: An ISO 3166-1 alpha-2 country code. Provide this parameter if you want the list of returned items to be relevant to a particular country. If omitted, the returned items will be relevant to all countries.limit
: The maximum number of tracks to return. Default is set to 20.offset
: The index of the first track to return. Default is 0.
Example
julia> artist_get_albums("0YC192cP3KPCRWx8zr8MfZ")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:href => "https://api.spotify.com/v1/artists/0YC192cP3KPCRWx8zr8MfZ/albums?offset=0&limit=20&include_groups=album…
:items => Object[{…
:limit => 20
:next => "https://api.spotify.com/v1/artists/0YC192cP3KPCRWx8zr8MfZ/albums?offset=20&limit=20&include_groups=albu…
:offset => 0
:previous => nothing
:total => 663
Spotify.library_check_saved_albums
— MethodAlias for albumgetcontains in albums.jl
Spotify.library_get_saved_albums
— MethodAlias for albumgetsaved in albums.jl
Spotify.library_remove_albums
— MethodSame as albumremovefrom_library in Albums
Spotify.library_save_album
— MethodSame as albumsavelibrary
Artist
Spotify.artist_get
— Methodartist_get(artist_id)
Summary: Get Spotify catalog information for a single artist identified by their unique Spotify ID.
Arguments
artist_id
: The Spotify artist ID.
Example
julia> artist_get("0YC192cP3KPCRWx8zr8MfZ")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 10 entries:
:external_urls => {…
:followers => {…
:genres => ["german soundtrack", "soundtrack"]
:href => "https://api.spotify.com/v1/artists/0YC192cP3KPCRWx8zr8MfZ"
Spotify.artist_get_related_artists
— Methodartist_get_related_artists(artist_id)
Summary: Get spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community's listening history.
Arguments
artist_id
: The Spotify ID of the artist
Example
julia> artist_get_related_artists("0YC192cP3KPCRWx8zr8MfZ")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:artists => JSON3.Object[{…
Spotify.artist_top_tracks
— Methodartist_top_tracks(artist_id; market = get_user_country())
Summary: Get Spotify catalog information about an artist's top tracks by country.
Arguments
artist_id
: The Spotify ID of the artist
Optional keyword arguments
market
: Default isget_user_country()
. An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.API note: "If neither market or user country are provided, the content is considered unavailable for the client. Users can view the country that is associated with their account in the account settings." Spotify.jl note: If no market is specified, we unexpectedly get 'missing country parameter'. We do not want this behaviour to be general for all calls with an optional "market" argument. A default 'market = ""' is acceptable for all (?) other API calls with 'market'.
Example
julia> artist_top_tracks("0YC192cP3KPCRWx8zr8MfZ")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:tracks => JSON3.Object[{…
Spotify.users_follow_artists_users
— Methodusers_follow_artists_users(artist_ids; type= "artist")
Follow Artists or Users
Summary: Add the current user as a follower of one or more artists or other Spotify users.
Arguments
artist_ids
Required: A comma-separated list of the artists or users Spotify IDs. Maximum 50. type
Optional: The ID type: either artist
(default) or user
Example
julia> artist_ids = SpArtistId.(["2CIMQHirSU0MQqyYHq0eOx", "57dN52uHvrHOxijzpIgu3E", "1vCWHaC5f2uS3yhpwWbIA6"])
3-element Vector{SpArtistId}:
spotify:artist:2CIMQHirSU0MQqyYHq0eOx
spotify:artist:57dN52uHvrHOxijzpIgu3E
spotify:artist:1vCWHaC5f2uS3yhpwWbIA6
julia> users_follow_artists_users(artist_ids)[1]
{}
julia> # Cleanup
julia> users_unfollow_artists_users(artist_ids)
{}
Spotify.users_unfollow_artists_users
— Methodusers_unfollow_artists_users(artist_ids; type = "artist")
Summary: Remove the current user as a follower of one or more artists or other Spotify users.
Arguments
artist_ids
Required: A comma-separated list of the artists' or users' Spotify IDs. Maximum 50.
Optional keyword arguments
type
: Either "artist" (default) or "user".
julia> artist_ids = ["2CIMQHirSU0MQqyYHq0eOx", "57dN52uHvrHOxijzpIgu3E", "1vCWHaC5f2uS3yhpwWbIA6"]
3-element Vector{String}:
"2CIMQHirSU0MQqyYHq0eOx"
"57dN52uHvrHOxijzpIgu3E"
"1vCWHaC5f2uS3yhpwWbIA6"
julia> users_unfollow_artists_users(artist_ids])[1]
{}
Browse
Spotify.category_get_featured_playlist
— MethodSame as playlistgetfeatured in Playlists
Spotify.category_get_multiple
— Methodcategory_get_multiple(;country = "", locale = "", limit = 20, offset = 0)
Summary: Get a list of categories used to tag items in Spotify (on, for example, the Spotify player’s “Browse” tab).
Optional keywords
country
: An ISO 3166-1 alpha-2 country code. Provide this parameter if you want the list of returned items to be relevant to a particular country. If omitted, the returned items will be relevant to all countries.locale
: The desired language, consisting of a lowercase ISO 639-1 language code and an uppercase
ISO 3166-1 alpha-2 country code, joined by an underscore. For example: esMX, meaning "Spanish (Mexico)". Provide this parameter if you want the results returned in a particular language (where available). Default is set to "enUS".
limit
: Maximum number of items to return, default is set to 20offset
: Index of the first item to return, default is set to 0
Example
julia-repl julia> category_get_multiple()[1].categories.items .|> i-> i.name 20-element Vector{String}: "Top Lists" "EQUAL" "Pop" ⋮ "Rock" "Metal" "Sleep"
Spotify.category_get_new_releases
— Methodcategory_get_new_releases(;country = "", locale = "", limit = 20, offset = 0)
Summary: Get a list of new album releases featured in Spotify (shown, for example, on a Spotify player’s “Browse” tab).
Optional keywords
country
: An ISO 3166-1 alpha-2 country code. Provide this parameter if you want the list of returned items to be relevant to a particular country. If omitted, the returned items will be relevant to all countries.locale
: The desired language, consisting of a lowercase ISO 639-1 language code and an uppercase ISO 3166-1 alpha-2 country code, joined by an underscore. For example: esMX, meaning "Spanish (Mexico)". Provide this parameter if you want the results returned in a particular language (where available). Default is set to "enUS".limit
: Maximum number of items to return, default is set to 20offset
: Index of the first item to return, default is set to 0
Example
julia> category_get_new_releases()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:albums => {…
Spotify.category_get_playlist
— MethodSame as playlistgetcategory in Playlists
Spotify.category_get_single
— Methodcategory_get_single(category_name; country = "", locale = "")
Summary: Get a single category used to tag items in Spotify (on, for example, the Spotify player’s “Browse” tab).
Arguments
category_name
: The Spotify category ID for the category.
Optional keywords
country
: An ISO 3166-1 alpha-2 country code. Provide this parameter if you want the list of returned items to be relevant to a particular country. If omitted, the returned items will be relevant to all countries.locale
: The desired language, consisting of a lowercase ISO 639-1 language code and an uppercase ISO 3166-1 alpha-2 country code, joined by an underscore. For example: esMX, meaning "Spanish (Mexico)". Provide this parameter if you want the results returned in a particular language (where available). Default is set to "enUS".
Example
julia> category_get_single("party")[1].name
"Party"
julia> category_get_single("party", locale = "es_MX")[1].name
"Fiesta"
Spotify.playlist_get_category
— Methodplaylist_get_category(category_name; country = "", limit = 20, offset = 0)
Summary: Get a list of Spotify playlists tagged with a particular category.
Arguments
category_name
: The unique string identifying the Spotify category, e.g. "dinner", "party" etc.
Optional keywords
country
: An ISO 3166-1 alpha-2 country code. Provide this parameter if you want the list of returned items to be relevant to a particular country. If omitted, the returned items will be relevant to all countries.limit
: Maximum number of items to return, default is set to 20offset
: Index of the first item to return, default is set to 0
Example
julia> playlist_get_category("party")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:playlists => {…
Episodes
Spotify.episodes_get_contains
— Methodepisodes_get_contains(episode_ids)
Summary: Check if one or more episodes is already saved in the current Spotify user's 'Your Episodes' library. This API endpoint is in beta and could change without warning.
Arguments
ids
: A comma-separated list of the Spotify episode IDs
Example
julia> episodes_get_contains(["77o6BIVlYM3msb4MMIL1jH", "0Q86acNRm6V9GYx55SXKwf"])[1]
2-element JSON3.Array{Bool, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
0
0
Spotify.episodes_get_multiple
— Methodepisodes_get_multiple(episode_ids; market = get_user_country())
Summary: Get Spotify catalog information for several episodes based on their Spotify IDs.
Arguments
episode_ids
: A comma-separated list of the Spotify IDs for the episodes. Maximum: 50 IDs.
Optional keywords
market
: Default: getusercountry(). An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. Note: If neither market or user country are provided, the content is considered unavailable for the client. Users can view the country that is associated with their account in the account settings.
Example
julia> episodes_get_multiple(["77o6BIVlYM3msb4MMIL1jH", "0Q86acNRm6V9GYx55SXKwf"])[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:episodes => JSON3.Object[{…
Spotify.episodes_get_saved
— Methodepisodes_get_saved(;limit = 20, market = "", offset = 0)
Summary: Get a list of the episodes saved in the current Spotify user's library. This API endpoint is in beta and could change without warning.
Optional keywords
limit
: Maximum number of items to return, default is set to 20market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. Note: If neither market or user country are provided, the content is considered unavailable for the client. Users can view the country that is associated with their account in the account settings.offset
: Index of the first item to return, default is set to 0
Example
```julia-repl julia> episodesgetsaved()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries: :href => "https://api.spotify.com/v1/me/episodes?offset=0&limit=20&market=US" :items => Union{}[] :limit => 20
Spotify.episodes_get_single
— Methodepisodes_get_single(episode_id; market = get_user_country())
Summary: Get Spotify catalog information for a single episode identified by its unique Spotify ID.
Arguments
episode_id
: The Spotify ID for the episode_id
Optional keywords
market
: Default isget_user_country()
. An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. Note: If neither market or user country are provided, the content is considered unavailable for the client. Users can view the country that is associated with their account in the account settings.
Example
julia> episodes_get_single("512ojhOuo1ktJprKbVcKyQ")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 19 entries:
:audio_preview_url => "https://p.scdn.co/mp3-preview/566fcc94708f39bcddc09e4ce84a8e5db8f07d4d"
:description => "En ny tysk bok granskar för första gången Tredje rikets drogberoende, från Führerns k…
:duration_ms => 1502795
:explicit => false
:external_urls => {…
Spotify.show_get_episodes
— Methodshow_get_episodes(show_id; market = get_user_country(), limit = 20, offset = 0)
Summary: Get Spotify catalog information about a show’s episodes. Optional parameters can be used to limit the number of episodes returned.
Arguments
show_id
: The Spotify ID for the show
Optional keywords
market
: An ISO 3166-1 alpha-2 country code. If market is not provided, the content is considered unavailable for the client. Default value is taken from user's .ini file.limit
: Maximum number of items to return, default is set to 20. (0 < limit <= 50)offset
: Index of the first item to return, default is set to 0
Example
julia> ses = show_get_episodes("2MAi0BvDc6GTFvKFPXnkCL")[1];
julia> [s.name for s in ses.episodes.items]
50-element Vector{String}:
"#359 – Andrew Strominger: Black" ⋯ 17 bytes ⋯ "ravity, and Theoretical Physics"
"#358 – Aella: Sex Work, OnlyFans, Porn, Escorting, Dating, and Human Sexuality"
"#357 – Paul Conti: Narcissism, " ⋯ 18 bytes ⋯ "and the Nature of Good and Evil"
"#356 – Tim Dodd: SpaceX, Starship, Rocket Engines, and Future of Space Travel"
"#355 – David Kipping: Alien Civilizations and Habitable Worlds"
"#354 – Jeremi Suri: American Civil War"
⋮
"#315 – Magnus Carlsen: Greatest Chess Player of All Time"
"#314 – Liv Boeree: Poker, Game " ⋯ 18 bytes ⋯ "tion, Aliens & Existential Risk"
"#313 – Jordan Peterson: Life, Death, Power, Fame, and Meaning"
"#312 – Duncan Trussell: Comedy, Sentient Robots, Suffering, Love & Burning Man"
"#311 – Magatte Wade: Africa, Capitalism, Communism, and the Future of Humanity"
"#310 – Andrew Bustamante: CIA Spy"
Follow
Spotify.users_check_current_follows
— Methodusers_check_current_follows(item_type, ids)
Summary: Check to see if the current user is following one or more artists or other Spotify users.
Arguments
ids
Required: - A comma separated list of the artist. Maximum 50. - a single user.item_type
Optional: The ID type, eitherartist
(default) oruser
.
Example
julia> users_check_current_follows(["0YC192cP3KPCRWx8zr8MfZ"])[1]
1-element JSON3.Array{Bool, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
0
julia> users_check_current_follows("smedjan"; item_type = "user")[1]
1-element JSON3.Array{Bool, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
0
Spotify.users_check_follows_playlist
— Methodusers_check_follows_playlist(playlist_id, user_id)
Summary: Check to see if one or more Spotify users are following a specified playlist_id.
Arguments
playlist_id
Required: The Spotify ID of the playlist.user_id
Required: A comma separated list of the user Spotify IDS to check. Maximum 5.
Example
julia> users_check_follows_playlist("3cEYpjA9oz9GiPac4AsH4n", ["jmperezperez", "thelinmichael", "wizzler"])[1]
3-element JSON3.Array{Bool, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
1
0
0
Spotify.users_follow_playlist
— Methodusers_follow_playlist(playlist_id; public = false)
Summary: Add the current user as a follower of a playlist.
Argument
-playlist_id
: The Spotify ID of the playlist. Any playlist can be followed regardless of it's private/public status, as long as the ID is known.
Optional argument
public
: Defaults to false. If true the playlist will be included in user's public playlists, if false it will remain private.
Example
julia> playlist_id = SpPlaylistId("37i9dQZF1DX1rVvRgjX59F")
spotify:playlist:37i9dQZF1DX1rVvRgjX59F
julia> users_follow_playlist(playlist_id)[1]
{}
julia> users_unfollow_playlist(playlist_id)[1] # Cleanup
{}
Spotify.users_get_follows
— Methodusers_get_follows(; limit = 20, after = "")
Summary: Get the current user's followed artists.
Arguments
limit
Optional: The maximum number of items to return. Default 20, Minimum 1, Maximum 50.after
Optional: The last artist ID retrieved from the previous request.
Example
julia> o = users_get_follows(;limit = 10)[1];
julia> anames = [s.name for s in o.artists.items];
julia> while rem(length(anames), 10) == 0
id = o.artists.items[end].id
o = users_get_follows(;after = id)[1]
anames = vcat(anames, [s.name for s in o.artists.items])
end
julia> julia> length(anames)
26
Spotify.users_unfollow_playlist
— Methodusers_unfollow_playlist(playlist_id)
Summary: Remove the current user as a follower of a playlist. If none are following, this substitutes for 'delete'.
playlist_id
Required: The Spotify ID of the playlist. Any playlist can be followed regardless of it's private/public status, as long as the ID is known.
Arguments
playlist_id
The Spotify ID of the playlist.
Example
To be run after example in playlist_create_playlist
, possibly also 'playlistremoveplaylist_item`.
julia> users_unfollow_playlist(myownplaylistid)[1]
{}
Also see users_follow_playlist
Genres
Spotify.genres_get
— Methodgenres_get()
Summary: Retrieve a list of available genres seed parameter values for recommendations.
Example
julia> genres_get()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:genres => ["acoustic", "afrobeat", "alt-rock", "alternative", "ambient", "anime", "black-metal",…
Library
Endpoints referenced here are included in the library section. These functions act on whoever has authorized their account to be queried. They can answer questions like
Spotify.library_check_saved_shows
— MethodAlias for showgetcontains in shows.jl
Spotify.library_check_saved_tracks
— MethodAlias for tracksgetcontains in tracks.jl
Spotify.library_get_saved_shows
— MethodAlias for showgetsaved in shows.jl
Spotify.library_get_saved_tracks
— MethodAlias for tracksgetsaved in tracks.jl
Spotify.library_remove_shows
— MethodSame as showremovefrom_library
Spotify.library_remove_tracks
— MethodSame as tracksremovefrom_library
Spotify.library_save_show
— MethodSame as showsavelibrary
Spotify.library_save_track
— MethodSame as trackssavelibrary
Spotify.show_remove_from_library
— Methodshow_remove_from_library(show_ids)
Summary: Remove one or more shows for the current user's library.
show_ids
Required: A comma-separated list of the Spotify IDs. Maximum 50.
Example
julia> show_remove_from_library(["5AvwZVawapvyhJUIx71pdJ", "6ups0LMt1G8n81XLlkbsPo"])[1]
{}
Spotify.show_save_library
— Methodshow_save_library(show_ids)
Save Shows for Current User
** Summary**: Save one or more shows to the current user's library.
show_ids
Required: A comma-separated list of Spotify IDs. Maximum 50.
Spotify.tracks_remove_from_library
— Methodtracks_remove_from_library(track_ids)
Summary: Remove one or more tracks for the current user's 'Your Music' library.
track_ids
Required: A comma-separated list of the Spotify IDs. Maximum 50.
Example
julia> tracks_remove_from_library(["0WdUHon5tYn2aKve13psfy", "619OpJGKpAOrp5rM4Gcs65"])[1]
{}
Spotify.tracks_save_library
— Methodtracks_save_library(track_ids)
** Summary**: Save one or more tracks to the current user's 'Your Music' library.
track_ids
Required: A comma-separated list of Spotify IDs. Maximum 50.
Example
julia> tracks_save_library(["0WdUHon5tYn2aKve13psfy", "619OpJGKpAOrp5rM4Gcs65"])[1]
{}
Markets
Spotify.markets_get
— Methodmarkets_get()
Summary: Get the list of markets where Spotify is available.
Example
julia> markets_get()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:markets => ["AD", "AE", "AG", "AL", "AM", "AO", "AR", "AT", "AU", "AZ" …
Playlists
Spotify.playlist_add_tracks_to_playlist
— Methodplaylist_add_tracks_to_playlist(playlist_id, track_ids; position = -1)
Summary: Add one or more items to a user's playlist.
Arguments
playlist_id
: The Spotify ID of the playlist.track_ids
: A maximum of 100 items can be added in one request.
Optional keywords
position
: The position to insert the items, a zero-based index. For example, to insert the items in the first position: position = 0; to insert the items in the third position: position = 2. The default value is -1, meaning we omit the argument in the API call. When omitted, the items will be appended to the playlist. Items are added in the order they are listed in the query string or request body.
Example (continued from playlist_create_playlist
)
julia> track_ids = SpTrackId.(["4m6P9J3czb5hiMIuNsWeVO", "619OpJGKpAOrp5rM4Gcs65"])
2-element Vector{SpTrackId}:
spotify:track:4m6P9J3czb5hiMIuNsWeVO
spotify:track:619OpJGKpAOrp5rM4Gcs65
julia> playlist_add_tracks_to_playlist(myownplaylistid, track_ids)[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:snapshot_id => "Myw3OTkwNGExNzExNjA2ZWRhMDBkYjgwOWEwNzgzNGY2ZTRiODU3ZTkz"
julia> # Cleanup: See `playlist_remove_playlist_item`
Or, for one of your own playlists,
julia> function get_my_own_playlist()
pls = playlist_get_current_user()[1]
for p in pls.items
if p.owner.id == Spotify.get_user_name()
return p
end
end
nothing
end
julia> myownplaylistid = get_my_own_playlist().id |> SpPlaylistId
spotify:playlist:6VX6WsbD9CpEGMAxuQEbm3
julia> track_ids = SpTrackId.(["4m6P9J3czb5hiMIuNsWeVO", "619OpJGKpAOrp5rM4Gcs65"]);
julia> playlist_add_tracks_to_playlist(myownplaylistid, track_ids)[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:snapshot_id => "MTEsOWE1MjA0M2IxMDlhYjFjM2M2OGE0YTBlOWM4MTY1OGVjYWU2NWQxMw=="
julia> # Cleanup: See `playlist_remove_playlist_item`
Spotify.playlist_change_details
— MethodSummary: Change a playlist's name and public/private state. (The user must, of course, own the playlist.)
Arguments
playlist_id
: Alphanumeric ID of the playlist
Optional keywords
name
The new name for the playlist. Default: Argument not sent.public
If true the playlist will be public, if false it will be private. Default: Argument not sent.collaborative
If true, the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client. Note: You can only set collaborative to true on non-public playlists. Default: Argument not sent.description
Value for playlist description as displayed in Spotify Clients and in the Web API. Default: Argument not sent.
Spotify.playlist_create_playlist
— Methodplaylist_create_playlist(playlist_name; user_id = get_user_name(), public = true, collaborative = false, description = "")
Summary: Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)
Arguments
playlist_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.
Optional keywords
user_id
Defaults to getusername(), from the .ini filepublic
::Boolean Defaults to true. If true the playlist will be public, if false it will be private. To be able to create private playlists, the user must have granted the playlist-modify-private scopecollaborative
::Boolean Defaults to false. If true the playlist will be collaborative. Note: to create a collaborative playlist you must also set public to false. To create collaborative playlists you must have granted playlist-modify-private and playlist-modify-public scopes.description
Value for playlist description as displayed in Spotify Clients and in the Web API.
Example
julia> description = "Songs about orcs learning to code after being laid off from the mines of Mordor";
julia> playlist = playlist_create_playlist("Temporary private playlist"; description)[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 15 entries:
:collaborative => false
:description => nothing
:external_urls => {…
:followers => {…
:href => "https://api.spotify.com/v1/playlists/6VX6WsbD9CpEGMAxuQEbm3"
⋮ => ⋮
julia> myownplaylistid = playlist.id |> SpPlaylistId
spotify:playlist:0akFdMBfiqbkAUSY5hTYKs
julia> # Cleanup: See `playlist_add_tracks_to_playlist`, or skip straight to `Spotify.Users.users_unfollow_playlist`
Spotify.playlist_get
— Methodplaylist_get(playlist_id; additional_types = "track", fields = "",
market = "")
Summary: Get details about a playlist owned by a Spotify user. NOTE 1: For private playlists with > 100 tracks, use playlist_get_tracks
instead. NOTE 2: For public playlists with > 50 tracks, don't expect to see beyound 50.
Arguments
playlist_id
: Alphanumeric ID of the playlist
Optional keywords
additional_types
: "track" (default) or "episode"fields
: Filters for the query, a comma-separated list of the fields to return. For example, to get just the added date and user ID of the adder, fields = "items(addedat,addedby.id)". Default is set to "", which means all fields are returned.market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only episodes that are available in that market will be returned. Default is set to "US".
Example
This works with severe limitations to the number of tracks returned.
julia-repl julia> using Spotify, Spotify.Playlists julia> playlist_get("37i9dQZF1E4vUblDJbCkV3")[1] JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 15 entries: :collaborative => false :description => "With Roo Panes, Hiss Golden Messenger, Nathaniel Rateliff and more" :external_urls => {… :followers => {… :href => "https://api.spotify.com/v1/playlists/37i9dQZF1E4vUblDJbCkV3?additional_types=track" :id => "37i9dQZF1E4vUblDJbCkV3" :images => JSON3.Object[{… :name => "Lord Huron Radio" :owner => {… :primary_color => nothing :public => false :snapshot_id => "MTYzNTg2NzMxNCwwMDAwMDAwMGU3MTgwNDkzOWE5NTQ2NGM1NmYzNTYyZDhhZTc1ZGNh" :tracks => {… :type => "playlist" :uri => "spotify:playlist:37i9dQZF1E4vUblDJbCkV3"
# Example, general use
```julia-repl
julia> @time let
playlist_id = SpPlaylistId("37i9dQZF1E4vUblDJbCkV3") # public, meets limitations.
playlist_id = SpPlaylistId("3FyJWXqFocKq2SYGjGoelU") # private, this works with up to 100 tracks.
fields = "name,tracks(total)"
pll = playlist_get(playlist_id; fields)[1];
# This returns 50 in longer playlists, except when the playlist is your own.
ntot = pll.tracks.total
if ntot < 101
println("Retrieving all ", ntot, " tracks from ", pll.name)
else
println("Unable to retrieva all ", ntot, " tracks. Refer to `playlist_get_tracks`")
end
# We unnecessarily limit the data returned here. It does not help with the upper limit.
fields = "tracks(items(track(id,name)),next)"
o, waitsec = playlist_get(playlist_id; fields);
track_names = o.tracks.items .|> i -> i.track.name |> string
track_ids = o.tracks.items .|> i -> i.track.id |> SpTrackId
end;
Unable to retrieva all 529 tracks. Refer to `playlist_get_tracks`
0.837955 seconds (612.52 k allocations: 30.531 MiB, 1.90% gc time, 17.00% compilation time) ```
Spotify.playlist_get_cover_image
— Methodplaylist_get_cover_image(playlist_id)
Summary: Get the current image associated with a specific playlist.
Arguments
playlist_id
: Alphanumeric ID of the playlist
Example
julia> playlist_get_cover_image("37i9dQZF1E4vUblDJbCkV3")[1]
1-element JSON3.Array{JSON3.Object, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
{
"height": nothing,
"url": "https://seeded-session-images.scdn.co/v1/img/artist/6ltzsmQQbmdoHHbLZ4ZN25/en",
"width": nothing
}
Spotify.playlist_get_current_user
— Methodplaylist_get_current_user(limit = 20, offset = 0)
Summary: Get a list of the playlists owned or followed by the current Spotify user.
Optional keywords
limit
: Maximum number of items to return, default is set to 20. Minimum: 1. Maximum: 50.offset
: Index of the first item to return, default is set to 0
Example
julia> playlist_get_current_user()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:href => "https://api.spotify.com/v1/users/your_user_id/playlists?offset=0&limit=20"
:items => JSON3.Object[{…
:limit => 20
:next => nothing
:offset => 0
:previous => nothing
:total => 2
Spotify.playlist_get_featured
— Methodplaylist_get_featured(;country = "", limit = 20, locale = "",
offset = 0, timestamp = now())
Summary: Get a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).
Optional keywords
country
: An ISO 3166-1 alpha-2 country code. Provide this parameter if you want the list of returned items to be relevant to a particular country. If omitted, the returned items will be relevant to all countries.limit
: Maximum number of items to return, default is set to 20locale
: The desired language, consisting of a lowercase ISO 639-1 language code and an uppercase ISO 3166-1 alpha-2 country code, joined by an underscore. For example: es_MX, meaning "Spanish (Mexico)". Provide this parameter if you want the results returned in a particular language (where available).offset
: Index of the first item to return, default is set to 0timestamp
: A timestamp in ISO 8601 format: yyyy-MM-ddTHH:mm:ss. Use this parameter to specify the user's local time to get results tailored for that specific date and time in the day. Default is set to user's current time.
Example
julia> playlist_get_featured(locale = "en_UK")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 2 entries:
:message => "Tuesday jams"
:playlists => {…
Spotify.playlist_get_tracks
— Methodplaylist_get_tracks(playlist_id; additional_types = "track", limit = 50,
offset = 0, market = "")
Summary: Get details about the items of a playlist. NOTE: requires several calls for long lists.
Arguments
playlist_id
: Alphanumeric ID of the playlist
Optional keywords
additional_types
: "track" (default) or "episode"fields
: Filters for the query, a comma-separated list of the fields to return. For example, to get just the added date and user ID of the adder, fields = "items(addedat,addedby.id)". Default is set to "", which means all fields are returned.limit
: Maximum number of items to return, default is set to 20. Minimum: 1. Maximum: 50.offset
: Index of the first item to return, default is set to 0market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only episodes that are available in that market will be returned. Default is set to "US".
Example
For fewer than 21 tracks:
julia> playlist_get_tracks("37i9dQZF1E4vUblDJbCkV3")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:href => "https://api.spotify.com/v1/playlists/37i9dQZF1E4vUblDJbCkV3/tracks?offset=0&limit=20&market=US&additional_types=…
:items => JSON3.Object[{…
:limit => 20
:next => "https://api.spotify.com/v1/playlists/37i9dQZF1E4vUblDJbCkV3/tracks?offset=20&limit=20&market=US&additional_types…
:offset => 0
:previous => nothing
:total => 50
Example, general use
For longer playlists, we should ask for the fields we need only. The rate limits should be returned in 'waitsec', but this does not seem to work as documented with long playlists not owned by user.
julia> @time let
playlist_id = SpPlaylistId("37i9dQZF1E4vUblDJbCkV3") # public, meets limitations at 50 items.
playlist_id = SpPlaylistId("3FyJWXqFocKq2SYGjGoelU") # private, this works well.
fields = "name,tracks(total)"
pll = playlist_get(playlist_id; fields)[1];
ntot = pll.tracks.total
println("Retrieving all ", ntot, " tracks from ", pll.name)
fields = "items(track(name,id)),total, next"
o, waitsec = playlist_get_tracks(playlist_id; fields, limit=100);
track_ids = o.items .|> i -> i.track.id |> SpTrackId
while o.next !== nothing
if waitsec > 0
println("waiting ", waitsec, " s")
sleep(waitsec)
else
print(".")
end
o, waitsec = playlist_get_tracks(playlist_id; offset = length(track_ids), fields, limit=100);
append!(track_ids, o.items .|> i -> i.track.id |> SpTrackId)
end
println("Found ", length(track_ids), " tracks")
track_ids
end;
Retrieving all 529 tracks from -- Liked from Radio --
.....Found 529 tracks
2.669471 seconds (645.63 k allocations: 32.448 MiB, 4.26% compilation time)
Spotify.playlist_get_user
— Methodplaylist_get_user(user_id; limit = 20, offset = 0)
Summary: Get a list of the playlists owned or followed by a Spotify user.
Arguments
user_id
: Alphanumeric ID of the user or name (e.g. "smedjan")
Optional keywords
limit
: Maximum number of items to return, default is set to 20offset
: Index of the first item to return, default is set to 0
Example
julia> playlist_get_user("smedjan")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:href => "https://api.spotify.com/v1/users/smedjan/playlists?offset=0&limit=20"
:items => JSON3.Object[{…
:limit => 20
:next => "https://api.spotify.com/v1/users/smedjan/playlists?offset=20&limit=20"
:offset => 0
:previous => nothing
:total => 98
Spotify.playlist_remove_playlist_item
— Methodplaylist_remove_playlist_item(playlist_id, track_ids)
Summary: Remove one or more items from a user's playlist. For 'deleting playlists', see 'usersunfollowartists_users'.
Arguments
playlist_id
The Spotify ID of the playlist.track_ids
A maximum of 100 items can be removed in one request.
Example (to be run after examples in playlist_create_playlist
and playlist_add_tracks_to_playlist
.
julia> playlist_remove_playlist_item(myownplaylistid, track_ids)[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:snapshot_id => "NCwwNWI4YjdjODk5OWI1MGRlZTIzYjdjYzY4ZDhkMzczZDMyYzQ1YTRl"
julia> # Cleanup: This example is continued under `Spotify.Users.users_unfollow_playlist`.
Search
Spotify.search_get
— Methodsearch_get(q; item_type = "track,artist", include_external = "",
limit = 20, market = "", offset = 0)
Summary: Get Spotify catalog information about albums, artists, playlists, tracks, shows or episodes that match a keyword string. Note: Audiobooks are only available for the US, UK, Ireland, New Zealand and Australia markets.
Arguments
q
: Search query, e.g. "Coldplay".
Optional keywords arguments
type
: A comma-separated list of item types to search across. Search results include hits from all the specified item types. For example, item_type = "album,tarck" returns both albums and tracks with the search query included in their name.include_external
: If include_external = "audio" is specified then the response will include any relevant audio content that is hosted externally.limit
: Maximum number of items to return, default is set to 20market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only episodes that are available in that market will be returned. Default is set to "US".offset
: Index of the first item to return, default is set to 0
Example
julia> search_get("Coldplay")[1]
GET https://api.spotify.com/v1/search?q=Coldplay&type=track,artist&include_external=&limit=20&market=US&offset=0
scopes in current credentials: String[]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 2 entries:
:artists => {…
:tracks => {…
Shows
Spotify.show_get_contains
— Methodshow_get_contains(show_ids)
Summary: Check if one or more shows is already saved in the current Spotify user's library.
Arguments
ids
: A comma-separated list of the Spotify IDs for the shows. Maximum: 50 IDs.
Example
julia> show_ids = SpShowId.(["5AvwZVawapvyhJUIx71pdJ", "6ups0LMt1G8n81XLlkbsPo"])
2-element Vector{SpShowId}:
spotify:show:5AvwZVawapvyhJUIx71pdJ
spotify:show:6ups0LMt1G8n81XLlkbsPo
julia> show_get_contains(show_ids)[1]
2-element JSON3.Array{Bool, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
1
1
Spotify.show_get_multiple
— Methodshow_get_multiple(ids; market = get_user_country())
Summary: Get Spotify catalog information for several shows based on their Spotify IDs.
Arguments
show_ids
: A comma-separated list of the Spotify IDs for the shows. Maximum: 50 IDs.
Optional keywords
market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes that are available in that market will be returned. If market is not provided, the content is considered unavailable for the client. Default value is taken from user's .ini file.
Example
julia> julia> show_ids = SpShowId.(["5AvwZVawapvyhJUIx71pdJ", "6ups0LMt1G8n81XLlkbsPo"])
2-element Vector{SpShowId}:
spotify:show:5AvwZVawapvyhJUIx71pdJ
spotify:show:6ups0LMt1G8n81XLlkbsPo
julia> shs = show_get_multiple(show_ids)[1];
julia> [s.name for s in shs.shows]
3-element Vector{String}:
"The Giant Beastcast"
"The Filmcast (AKA The Slashfilmcast)"
Spotify.show_get_saved
— Methodshow_get_saved(;limit = 20, offset = 0)
Summary: Get a list of shows saved in the current Spotify user's library. Optional parameters can be used to limit the number of shows returned.
Optional keywords
limit
: Maximum number of items to return, default is set to 20. (0 < limit <= 50)offset
: Index of the first item to return, default is set to 0
Example
julia> show_get_saved()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:href => "https://api.spotify.com/v1/me/shows?offset=0&limit=20"
:items => Union{}[]
:limit => 20
Spotify.show_get_single
— Methodshow_get(show_id; market = get_user_country())
Summary: Get a Spotify catalog information for a single show identified by it's unique Spotify ID.
Arguments
show_id
: The Spotify ID for the show
Optional keywords
market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes that are available in that market will be returned. If market is not provided, the content is considered unavailable for the client. Default value is taken from user's .ini file.
Example
julia> show_get_single("2MAi0BvDc6GTFvKFPXnkCL")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 18 entries:
:available_markets => ["AD", "AE", "AG", "AL", "AM", "AR", "AT", "AU", "BA", "BB" … "TV", "TW", "US", "UY", "VC", …
:copyrights => Union{}[]
:description => "Conversations about science, technology, history, philosophy and the nature of intelligence, …
:episodes => {…
Tracks
Spotify.player_get_recent_tracks
— Methodplayer_get_recent_tracks(;duration = 1, limit = 20)
Summary: Get current user's recently played tracks.
Optional keywords
duration
: Number of days to look in the past, default is set to 1limit
: Maximum number of items to return, default is set to 20
Example
julia> player_get_recent_tracks()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 5 entries:
:items => JSON3.Object[{…
:next => "https://api.spotify.com/v1/me/player/recently-played?after=1636123644988&limit=20"
:cursors => {…
:limit => 20
:href => "https://api.spotify.com/v1/me/player/recently-played?after=1636410050&limit=20"
Spotify.tracks_get_audio_analysis
— Methodtracks_get_audio_analysis(track_id)
Summary: Get a detailed audio analysis for a single track identified by it's unique Spotify ID.
Arguments
track_id
: The Spotify ID for the track
Example
julia> tracks_get_audio_analysis("6rqhFgbbKwnb9MLmUQDhG6")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:meta => {…
:track => {…
:bars => JSON3.Object[{…
:beats => JSON3.Object[{…
Spotify.tracks_get_audio_features
— Methodtracks_get_audio_features(track_id)
Summary: Get audio feature information for a single track identified by it's unique Spotify ID.
Arguments
track_id
: The Spotify ID for the track
Example
julia> tracks_get_audio_features("6rqhFgbbKwnb9MLmUQDhG6")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 18 entries:
:danceability => 0.592
:energy => 0.0196
:key => 1
:loudness => -33.35
:mode => 1
:speechiness => 0.0358
:acousticness => 0.362
:instrumentalness => 0.854
Result parameters
acousticness
A confidence measure from 0.0 to 1.0 of whether the track is acoustic. 1.0 represents high confidence the track is acoustic.
analysis_url
A URL to access the full audio analysis of this track. An access token is required to access this data.
danceability
Danceability describes how suitable a track is for dancing based on a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. A value of 0.0 is least danceable and 1.0 is most danceable.
duration_ms
The duration of the track in milliseconds.
energy
Energy is a measure from 0.0 to 1.0 and represents a perceptual measure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy. For example, death metal has high energy, while a Bach prelude scores low on the scale. Perceptual features contributing to this attribute include dynamic range, perceived loudness, timbre, onset rate, and general entropy.
id
The Spotify ID for the track.
instrumentalness
Predicts whether a track contains no vocals. "Ooh" and "aah" sounds are treated as instrumental in this context. Rap or spoken word tracks are clearly "vocal". The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content. Values above 0.5 are intended to represent instrumental tracks, but confidence is higher as the value approaches 1.0.
key
= -1, <= 11
The key the track is in. Integers map to pitches using standard Pitch Class notation. E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on. If no key was detected, the value is -1.
liveness
Detects the presence of an audience in the recording. Higher liveness values represent an increased probability that the track was performed live. A value above 0.8 provides strong likelihood that the track is live.
loudness
The overall loudness of a track in decibels (dB). Loudness values are averaged across the entire track and are useful for comparing relative loudness of tracks. Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). Values typically range between -60 and 0 db.
mode
Mode indicates the modality (major or minor) of a track, the type of scale from which its melodic content is derived. Major is represented by 1 and minor is 0.
speechiness
Speechiness detects the presence of spoken words in a track. The more exclusively speech-like the recording (e.g. talk show, audio book, poetry), the closer to 1.0 the attribute value. Values above 0.66 describe tracks that are probably made entirely of spoken words. Values between 0.33 and 0.66 describe tracks that may contain both music and speech, either in sections or layered, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks.
tempo
The overall estimated tempo of a track in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration.
time_signature
= 3, <= 7
An estimated time signature. The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure). The time signature ranges from 3 to 7 indicating time signatures of "3/4", to "7/4".
track_href
A link to the Web API endpoint providing full details of the track.
type
The object type. Allowed value: "audio_features"
uri
The Spotify URI for the track.
valence
= 0, <= 1
A measure from 0.0 to 1.0 describing the musical positiveness conveyed by a track. Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), while tracks with low valence sound more negative (e.g. sad, depressed, angry).
Spotify.tracks_get_contains
— Methodtracks_get_contains(ids)
Summary: Check if one or more tracks is already saved in the current Spotify user's 'Your Music' library.
Arguments
ids
: A comma-separated list of the Spotify track IDs.
Example
julia> tracks_get_contains("4iV5W9uYEdYUVa79Axb7Rh, 4VqPOruhp5EdPBeR92t6lQ")[1]
2-element JSON3.Array{Bool, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
0
0
Spotify.tracks_get_multiple
— Methodtracks_get_multiple(track_ids, market = "")
Summary: Get Spotify catalog information for multiple tracks based on their Spotify IDs.
Arguments
track_ids
: A comma-separated list of the Spotify IDs.
Optional keywords
market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only episodes that are available in that market will be returned.
Example
julia> tracks_get_multiple(["7ouMYWpwJ422jRcDASZB7P", "4VqPOruhp5EdPBeR92t6lQ", "2takcwOaAZWiXQijPHIx7B"])[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
:tracks => Union{Nothing, JSON3.Object}[{…
Spotify.tracks_get_recommendations
— Methodtracks_get_recommendations(seeds_dict::Dict;
track_attributes::Dict = Dict{String, String}(), limit = 50, market = "")
Summary: Get Recommendations based on Seeds
Optional keywords
seeds_dict
: A dictionary containing keys (seedgenres, seedartists, seedtracks) and values for each key being seeds delimited by a comma up to 5 seeds for each category. Up to 5 seed values may be provided in any combination of seedartists, seedtracks and seedgenres. For example: Dict("seedartists" => "s33dart1st,s33edart!st2", "seedgenres" => "g3nre1,genr32", "seed_tracks" => "trackid1,trackid2")track_attributes
: A dictionary containing key values for ≈ 50 tunable track track_attributes, see reference.limit
: Maximum number of items to return, default is set to 20market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only episodes that are available in that market will be returned.
Reference
- (https://developer.spotify.com/documentation/web-api/reference/#/operations/get-recommendations)
Example
julia> seeds_dict = Dict("seed_artists" => "0YC192cP3KPCRWx8zr8MfZ")
Dict{String, String} with 1 entry:
"seed_artists" => "0YC192cP3KPCRWx8zr8MfZ"
julia> track_attributes = Dict("max_danceability" => "0.80")
Dict{String, String} with 1 entry:
"max_danceability" => "0.80"
julia> tracks_get_recommendations(seeds_dict; track_attributes)[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 2 entries:
:tracks => JSON3.Object[{…
:seeds => JSON3.Object[{…
Spotify.tracks_get_saved
— Methodtracks_get_saved(;limit = 20, market = "", offset = 0)
Summary: Get a list of the songs saved in the current Spotify user's 'Your Music' library.
Optional keywords
limit
: Maximum number of items to return, default is set to 20market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only episodes that are available in that market will be returned.offset
: Index of the first item to return, default is set to 0
Example
julia> tracks_get_saved()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:href => "https://api.spotify.com/v1/me/tracks?offset=0&limit=20&market=US"
:items => JSON3.Object[{…
:limit => 20
:next => "https://api.spotify.com/v1/me/tracks?offset=20&limit=20&market=US"
Spotify.tracks_get_single
— Methodtracks_get(track_id; market = "")
Summary: Get a spotify catalog information for a single track identified by it's unique Spotify ID.
Arguments
track_id
: The Spotify ID for the track.
Optional keywords
market
: An ISO 3166-1 alpha-2 country code. If a country code is specified, only episodes that are available in that market will be returned.
Example
julia> tracks_get("6rqhFgbbKwnb9MLmUQDhG6")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 18 entries:
:album => {…
:artists => JSON3.Object[{…
:disc_number => 1
:duration_ms => 65314
:explicit => true
:external_ids => {…
:external_urls => {…
Users
Spotify.users_get_current_profile
— Methodusers_get_current_profile()
**Summary**: Get detailed profile information about the current user
(including the current user's username).
The returned object contains more info when granted scopes: user-read-private and user-read-email.
Example
julia> users_get_current_profile()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 12 entries:
:country => "NL"
:display_name => "Itachi"
:email => "your_id@gmail.com"
:explicit_content => {…
:external_urls => {…
:followers => {…
:href => "https://api.spotify.com/v1/users/your_user_id"
:id => "your_user_id"
:images => Union{}[]
:product => "premium"
:type => "user"
:uri => "spotify:user:your_user_id"
Spotify.users_get_current_user_top_items
— Methodusers_get_current_user_top_items(;type = "artists", time_range = "medium_term", limit = 20, offset = 0)
Summary: Get the current user's top artists or tracks based on calculated affinity.
Optional keywords
type
: The type of entity to return. Valid values: "artists" or "tracks". Default: "artists".limit
: The maximum number of items to return. Default is set to 20. The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.offset
: The index of the first item to return. Default is 0.time_range
: Over what time frame the affinities are computed. Valid values: longterm (calculated from several years of data and including all new data as it becomes available), mediumterm (approximately last 6 months), shortterm (approximately last 4 weeks). Default: "mediumterm".
Example
julia> users_get_current_user_top_items()[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:items => JSON3.Object[{…
:total => 50
:limit => 20
:offset => 0
:previous => nothing
:href => "https://api.spotify.com/v1/me/top/artists"
:next => "https://api.spotify.com/v1/me/top/artists?limit=20&offset=20"julia> users_get_current_user_top_items(limit=1, type="tracks")[1].items;
The above used the default 'type' argument. We can also look for tracks:
julia> users_get_current_user_top_items(type="tracks")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 7 entries:
:items => JSON3.Object[{…
:total => 50
:limit => 20
:offset => 0
:previous => nothing
:href => "https://api.spotify.com/v1/me/top/tracks"
:next => "https://api.spotify.com/v1/me/top/tracks?limit=20&offset=20"
Spotify.users_get_profile
— Methodusers_get_profile(user_id)
Summary: Get public profile information about a Spotify user.
Arguments
user_id
: Alphanumeric ID of the user or name (e.g. "smedjan")
Example
julia> users_get_profile("smedjan")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 8 entries:
:display_name => "smedjan"
:external_urls => {…
:followers => {…
:href => "https://api.spotify.com/v1/users/smedjan"
:id => "smedjan"
:images => Union{}[]
:type => "user"
:uri => "spotify:user:smedjan"