2015-07-26 15:22:35 +01:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< meta http-equiv = "X-UA-Compatible" content = "IE=edge" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< meta name = "author" content = "JohnnyCrazy" >
< link rel = "shortcut icon" href = "../../img/favicon.ico" >
< title > Getting started - SpotifyAPI-NET< / title >
< link href = "../../css/bootstrap-custom.min.css" rel = "stylesheet" >
< link href = "../../css/font-awesome-4.0.3.css" rel = "stylesheet" >
< link href = "../../css/prettify-1.0.css" rel = "stylesheet" >
< link href = "../../css/base.css" rel = "stylesheet" >
< link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/agate.min.css" >
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- [if lt IE 9]>
< script src = "https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" > < / script >
< script src = "https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js" > < / script >
<![endif]-->
< / head >
< body >
< div class = "navbar navbar-default navbar-fixed-top" role = "navigation" >
< div class = "container" >
<!-- Collapsed navigation -->
< div class = "navbar-header" >
<!-- Expander button -->
< button type = "button" class = "navbar-toggle" data-toggle = "collapse" data-target = ".navbar-collapse" >
< span class = "sr-only" > Toggle navigation< / span >
< span class = "icon-bar" > < / span >
< span class = "icon-bar" > < / span >
< span class = "icon-bar" > < / span >
< / button >
<!-- Main title -->
< a class = "navbar-brand" href = "../.." > SpotifyAPI-NET< / a >
< / div >
<!-- Expanded navigation -->
< div class = "navbar-collapse collapse" >
<!-- Main navigation -->
< ul class = "nav navbar-nav" >
< li >
< a href = "../.." > Home< / a >
< / li >
< li class = "dropdown active" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > SpotifyWebAPI < b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu" >
< li class = "active" >
< a href = "./" > Getting started< / a >
< / li >
< li >
< a href = "../examples/" > Examples< / a >
< / li >
< li >
< a href = "../auth/" > Authentication< / a >
< / li >
< li >
< a href = "../albums/" > - Albums< / a >
< / li >
< li >
< a href = "../artists/" > - Artists< / a >
< / li >
< li >
< a href = "../browse/" > - Browse< / a >
< / li >
< li >
< a href = "../follow/" > - Follow< / a >
< / li >
< li >
< a href = "../library/" > - Library< / a >
< / li >
< li >
< a href = "../playlists/" > - Playlists< / a >
< / li >
< li >
< a href = "../profiles/" > - Profiles< / a >
< / li >
< li >
< a href = "../search/" > - Search< / a >
< / li >
< li >
< a href = "../tracks/" > - Tracks< / a >
< / li >
2015-11-07 19:45:15 +00:00
< li >
< a href = "../util/" > - Util< / a >
< / li >
2015-07-26 15:22:35 +01:00
< / ul >
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > SpotifyLocalAPI < b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu" >
< li >
< a href = "../../SpotifyLocalAPI/" > SpotifyLocalAPI< / a >
< / li >
< / ul >
< / li >
< / ul >
<!-- Search, Navigation and Repo links -->
< ul class = "nav navbar-nav navbar-right" >
< li >
< a rel = "next" href = "../.." >
< i class = "fa fa-arrow-left" > < / i > Previous
< / a >
< / li >
< li >
< a rel = "prev" href = "../examples/" >
Next < i class = "fa fa-arrow-right" > < / i >
< / a >
< / li >
< li >
< a href = "https://github.com/JohnnyCrazy/SpotifyAPI-NET" >
< i class = "fa fa-github" > < / i >
GitHub
< / a >
< / li >
< / ul >
< / div >
< / div >
< / div >
< div class = "container" >
< div class = "col-md-3" > < div class = "bs-sidebar hidden-print affix well" role = "complementary" style = "height=90%;" >
< ul class = "nav bs-sidenav" >
< li class = "main active" > < a href = "#getting-started" > Getting started< / a > < / li >
< li > < a href = "#first-steps" > First steps< / a > < / li >
< li > < a href = "#authentication" > Authentication< / a > < / li >
< li > < a href = "#examples" > Examples< / a > < / li >
< li > < a href = "#error-handling" > Error-Handling< / a > < / li >
2015-11-07 19:45:15 +00:00
< li > < a href = "#asynchronous" > Asynchronous< / a > < / li >
2015-07-26 15:22:35 +01:00
< li > < a href = "#api-reference" > API-Reference< / a > < / li >
< / ul >
< / div > < / div >
< div class = "col-md-9" role = "main" >
< h1 id = "getting-started" > Getting started< / h1 >
< p > This API provides full access to the new SpotifyWebAPI introduced < a href = "https://developer.spotify.com/web-api/" > here< / a > .< br / >
With it, you can search for Tracks/Albums/Artists and also get User-based information.< br / >
It's also possible to create new playlists and add tracks to it.< / p >
< hr / >
< h2 id = "first-steps" > First steps< / h2 >
< p > < strong > Imports< / strong > < br / >
So after you added the API to your project, you may want to add following imports to your files:< / p >
< pre > < code class = "cs" > using SpotifyAPI.Web; //Base Namespace
using SpotifyAPI.Web.Auth; //All Authentication-related classes
using SpotifyAPI.Web.Enums; //Enums
using SpotifyAPI.Web.Models; //Models for the JSON-responses
< / code > < / pre >
< p > < strong > Basic-Usage< / strong > < br / >
Now you can actually start doing calls to the SpotifyAPI, just create a new Instance of SpotifyWebAPI:< / p >
< pre > < code class = "cs" > private static SpotifyWebAPI _spotify;
public static void Main(String[] args)
{
_spotify = new SpotifyWebAPI()
{
UseAuth = false, //This will disable Authentication.
}
FullTrack track = _spotify.GetTrack(" 3Hvu1pq89D4R0lyPBoujSv" );
Console.WriteLine(track.Name); //Yeay! We just printed a tracks name.
//...
}
< / code > < / pre >
< hr / >
< h2 id = "authentication" > Authentication< / h2 >
< p > If you look through the available API-Methods, you will soon notice nearly all of them require Authentication.
2015-07-26 15:25:44 +01:00
Further infos on how to implement Authentication can be found < a href = "../../SpotifyWebAPI/auth" > here< / a > < / p >
2015-07-26 15:22:35 +01:00
< hr / >
< h2 id = "examples" > Examples< / h2 >
2015-07-26 15:25:44 +01:00
< p > A list of small examples can be found < a href = "../../SpotifyWebAPI/examples" > here< / a > . Do you think a specific example is missing? Feel free to open a PR/Issue!< / p >
2015-07-26 15:22:35 +01:00
< hr / >
< h2 id = "error-handling" > Error-Handling< / h2 >
< p > Every API-Call returns a reponse-model which consists of base-error model. To check if a specific API-Call was successful, use the following approach:< / p >
< pre > < code class = "cs" > PrivateProfile profile = _spotify.GetPrivateProfile();
if (profile.HasError())
{
Console.WriteLine(" Error Status: " + profile.Error.Status);
Console.WriteLine(" Error Msg: " + profile.Error.Message);
}
< / code > < / pre >
2015-11-07 19:45:15 +00:00
< h2 id = "asynchronous" > Asynchronous< / h2 >
< p > Every API-Call now has an asynchronous method. Just append < code > Async< / code > to the Method-Name.< br / >
Example:< / p >
< pre > < code class = "cs" > public async void Test()
{
var profile = await _spotify.GetPrivateProfileAsync();
Console.WriteLine(profile.DisplayName);
}
< / code > < / pre >
2015-07-26 15:22:35 +01:00
< hr / >
< h2 id = "api-reference" > API-Reference< / h2 >
< h3 id = "albums" > Albums< / h3 >
< ul >
2015-07-26 15:25:44 +01:00
< li > < a href = "../../SpotifyWebAPI/albums#getalbumtracks" > GetAlbumTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/albums#getalbum" > GetAlbum< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/albums#getseveralalbums" > GetSeveralAlbums< / a > < / li >
2015-07-26 15:22:35 +01:00
< / ul >
< h3 id = "artists" > Artists< / h3 >
< ul >
2015-07-26 15:25:44 +01:00
< li > < a href = "../../SpotifyWebAPI/artists#getartist" > GetArtist< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/artists#getrelatedartists" > GetRelatedArtists< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/artists#getartiststoptracks" > GetArtistsTopTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/artists#getartistsalbums" > GetArtistsAlbums< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/artists#getseveralartists" > GetSeveralArtists< / a > < / li >
2015-07-26 15:22:35 +01:00
< / ul >
< h3 id = "browse" > Browse< / h3 >
< ul >
2015-07-26 15:25:44 +01:00
< li > < a href = "../../SpotifyWebAPI/browse#getfeaturedplaylists" > GetFeaturedPlaylists< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/browse#getnewalbumreleases" > GetNewAlbumReleases< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/browse#getcategories" > GetCategories< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/browse#getcategory" > GetCategory< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/browse#getcategoryplaylists" > GetCategoryPlaylists< / a > < / li >
2015-07-26 15:22:35 +01:00
< / ul >
< h3 id = "follow" > Follow< / h3 >
< ul >
2015-07-26 15:25:44 +01:00
< li > < a href = "../../SpotifyWebAPI/follow#follow" > Follow< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/follow#unfollow" > Unfollow< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/follow#isfollowing" > IsFollowing< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/follow#followplaylist" > FollowPlaylist< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/follow#unfollowplaylist" > UnfollowPlaylist< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/follow#isfollowingplaylist" > IsFollowingPlaylist< / a > < / li >
2015-07-26 15:22:35 +01:00
< / ul >
< h3 id = "library" > Library< / h3 >
< ul >
2015-07-26 15:25:44 +01:00
< li > < a href = "../../SpotifyWebAPI/library#savetracks" > SaveTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/library#savetrack" > SaveTrack< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/library#getsavedtracks" > GetSavedTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/library#removesavedtracks" > RemoveSavedTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/library#checksavedtracks" > CheckSavedTracks< / a > < / li >
2015-12-07 13:20:34 +00:00
< li > < a href = "../../SpotifyWebAPI/library#savealbums" > SaveAlbums< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/library#savealbum" > SaveAlbum< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/library#getsavedalbums" > GetSavedAlbums< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/library#removesavedalbums" > RemoveSavedAlbums< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/library#checksavedalbums" > CheckSavedAlbums< / a > < / li >
2015-07-26 15:22:35 +01:00
< / ul >
< h3 id = "playlists" > Playlists< / h3 >
< ul >
2015-07-26 15:25:44 +01:00
< li > < a href = "../../SpotifyWebAPI/playlists#getuserplaylists" > GetUserPlaylists< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#getplaylist" > GetPlaylist< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#getplaylisttracks" > GetPlaylistTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#createplaylist" > CreatePlaylist< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#updateplaylist" > UpdatePlaylist< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#replaceplaylisttracks" > ReplacePlaylistTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#removeplaylisttracks" > RemovePlaylistTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#removeplaylisttrack" > RemovePlaylistTrack< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#addplaylisttracks" > AddPlaylistTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#addplaylisttrack" > AddPlaylistTrack< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/playlists#reorderplaylist" > ReorderPlaylist< / a > < / li >
2015-07-26 15:22:35 +01:00
< / ul >
< h3 id = "profiles" > Profiles< / h3 >
< ul >
2015-07-26 15:25:44 +01:00
< li > < a href = "../../SpotifyWebAPI/profiles#getpublicprofile" > GetPublicProfile< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/profiles#getprivateprofile" > GetPrivateProfile< / a > < / li >
2015-07-26 15:22:35 +01:00
< / ul >
< h3 id = "search" > Search< / h3 >
< ul >
2015-07-26 15:25:44 +01:00
< li > < a href = "../../SpotifyWebAPI/search#searchitems" > SearchItems< / a > < / li >
2015-07-26 15:22:35 +01:00
< / ul >
< h3 id = "tracks" > Tracks< / h3 >
< ul >
2015-07-26 15:25:44 +01:00
< li > < a href = "../../SpotifyWebAPI/tracks#getseveraltracks" > GetSeveralTracks< / a > < / li >
< li > < a href = "../../SpotifyWebAPI/tracks#gettrack" > GetTrack< / a > < / li >
2015-11-07 19:45:15 +00:00
< / ul >
< h3 id = "util" > Util< / h3 >
< ul >
< li > < a href = "../../SpotifyWebAPI/util" > Utility-Functions< / a > < / li >
2015-07-26 15:22:35 +01:00
< / ul > < / div >
< / div >
< script src = "https://code.jquery.com/jquery-1.10.2.min.js" > < / script >
< script src = "../../js/bootstrap-3.0.3.min.js" > < / script >
< script src = "../../js/base.js" > < / script >
2016-08-25 19:42:18 +01:00
< script src = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js" > < / script >
2015-07-26 15:22:35 +01:00
< script src = "../../highlight.js" > < / script >
< / body >
< / html >