Spotify.NET/SpotifyWebAPI/playlists/index.html
2017-10-27 15:37:28 +00:00

706 lines
22 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>- Playlists - 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 >
<a href="../gettingstarted/">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="../player/">- Player</a>
</li>
<li class="active">
<a href="./">- Playlists</a>
</li>
<li >
<a href="../profiles/">- Profiles</a>
</li>
<li >
<a href="../search/">- Search</a>
</li>
<li >
<a href="../tracks/">- Tracks</a>
</li>
<li >
<a href="../util/">- Util</a>
</li>
</ul>
</li>
<li >
<a href="../../SpotifyLocalAPI/">SpotifyLocalAPI</a>
</li>
</ul>
<!-- Search, Navigation and Repo links -->
<ul class="nav navbar-nav navbar-right">
<li >
<a rel="next" href="../player/">
<i class="fa fa-arrow-left"></i> Previous
</a>
</li>
<li >
<a rel="prev" href="../profiles/">
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="#getuserplaylists">GetUserPlaylists</a></li>
<li class="main "><a href="#getplaylist">GetPlaylist</a></li>
<li class="main "><a href="#getplaylisttracks">GetPlaylistTracks</a></li>
<li class="main "><a href="#createplaylist">CreatePlaylist</a></li>
<li class="main "><a href="#updateplaylist">UpdatePlaylist</a></li>
<li class="main "><a href="#replaceplaylisttracks">ReplacePlaylistTracks</a></li>
<li class="main "><a href="#removeplaylisttracks">RemovePlaylistTracks</a></li>
<li class="main "><a href="#removeplaylisttrack">RemovePlaylistTrack</a></li>
<li class="main "><a href="#addplaylisttracks">AddPlaylistTracks</a></li>
<li class="main "><a href="#addplaylisttrack">AddPlaylistTrack</a></li>
<li class="main "><a href="#reorderplaylist">ReorderPlaylist</a></li>
</ul>
</div></div>
<div class="col-md-9" role="main">
<h2 id="getuserplaylists">GetUserPlaylists</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Get a list of the playlists owned or followed by a Spotify user.</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>[limit]</td>
<td>The maximum number of playlists to return. Default: 20. Minimum: 1. Maximum: 50.</td>
<td><code>20</code></td>
</tr>
<tr>
<td>[offset]</td>
<td>The index of the first playlist to return. Default: 0 (the first object)</td>
<td><code>0</code></td>
</tr>
</tbody>
</table>
<p>Returns a <a href="https://developer.spotify.com/web-api/object-model/#playlist-object-simplified">SimplePlaylist</a> wrapped inside a <a href="https://developer.spotify.com/web-api/object-model/#paging-object">Paging Object</a></p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">Paging&lt;SimplePlaylist&gt; userPlaylists = _spotify.GetUserPlaylists(&quot;1122095781&quot;);
userPlaylists.Items.ForEach(playlist =&gt; playlist.Owner.DisplayName) //Who is the owner of the playlist?
</code></pre>
<hr />
<h2 id="getplaylist">GetPlaylist</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Get a playlist owned by a Spotify user.</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistId</td>
<td>The Spotify ID for the playlist.</td>
<td><code>"1TtEejT1y4D1WmcOnLfha2"</code></td>
</tr>
<tr>
<td>[fields]</td>
<td>Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are returned.</td>
<td><code>"description,uri"</code></td>
</tr>
<tr>
<td>[market]</td>
<td>An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</td>
<td>"DE"</td>
</tr>
</tbody>
</table>
<p>Returns a <a href="https://developer.spotify.com/web-api/object-model/#track-object-full">FullTrack</a></p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">FullPlaylist playlist = _spotify.GetPlaylist(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;);
playlist.Tracks.Items.ForEach(track =&gt; Console.WriteLine(track.Track.Name));
</code></pre>
<hr />
<h2 id="getplaylisttracks">GetPlaylistTracks</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Get full details of the tracks of a playlist owned by a Spotify user.</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistId</td>
<td>The Spotify ID for the playlist.</td>
<td><code>"1TtEejT1y4D1WmcOnLfha2"</code></td>
</tr>
<tr>
<td>[fields]</td>
<td>Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are returned.</td>
<td><code>"description,uri"</code></td>
</tr>
<tr>
<td>[limit]</td>
<td>The maximum number of tracks to return. Default: 100. Minimum: 1. Maximum: 100.</td>
<td><code>100</code></td>
</tr>
<tr>
<td>[offset]</td>
<td>The index of the first object to return. Default: 0 (i.e., the first object)</td>
<td><code>0</code></td>
</tr>
<tr>
<td>[market]</td>
<td>An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</td>
<td><code>DE</code></td>
</tr>
</tbody>
</table>
<p>Returns a <a href="https://developer.spotify.com/web-api/object-model/#playlist-object-simplified">PlaylistTrack</a> wrapped inside a <a href="https://developer.spotify.com/web-api/object-model/#paging-object">Paging Object</a></p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">Paging&lt;PlaylistTrack&gt; playlist = _spotify.GetPlaylistTracks(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;);
playlist.Items.ForEach(track =&gt; Console.WriteLine(track.Track.Name));
</code></pre>
<hr />
<h2 id="createplaylist">CreatePlaylist</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistName</td>
<td>The name for the new playlist, for example "Your Coolest Playlist". This name does not need to be unique.</td>
<td><code>"This is my new Playlist"</code></td>
</tr>
<tr>
<td>[isPublic]</td>
<td>default 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 scope.</td>
<td><code>true</code></td>
</tr>
</tbody>
</table>
<p>Returns a <a href="https://developer.spotify.com/web-api/object-model/#playlist-object-full">FullPlaylist</a></p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">FullPlaylist playlist = _spotify.CreatePlaylist(&quot;1122095781&quot;, &quot;This is my new Playlist&quot;);
if(!playlist.HasError())
Console.WriteLine(&quot;Playlist-URI: &quot; + playlist.Uri);
</code></pre>
<hr />
<h2 id="updateplaylist">UpdatePlaylist</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Change a playlists name and public/private state. (The user must, of course, own the playlist.)</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistId</td>
<td>The Spotify ID for the playlist.</td>
<td><code>"1TtEejT1y4D1WmcOnLfha2"</code></td>
</tr>
<tr>
<td>[newName]</td>
<td>The new name for the playlist, for example "My New Playlist Title".</td>
<td><code>"New Playlistname"</code></td>
</tr>
<tr>
<td>[newPublic]</td>
<td>If true the playlist will be public, if false it will be private.</td>
<td>EXAMPLE</td>
</tr>
</tbody>
</table>
<p>Returns a <strong>ErrorResponse</strong> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">ErrorResponse response = _spotify.UpdatePlaylist(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;, &quot;New Name&quot;, true);
if(!response.HasError())
Console.WriteLine(&quot;success&quot;);
</code></pre>
<hr />
<h2 id="replaceplaylisttracks">ReplacePlaylistTracks</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for replacing tracks, re-ordering existing tracks, or clearing the playlist.</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistId</td>
<td>The Spotify ID for the playlist.</td>
<td><code>"1TtEejT1y4D1WmcOnLfha2"</code></td>
</tr>
<tr>
<td>uris</td>
<td>A list of Spotify track URIs to set. A maximum of 100 tracks can be set in one request.</td>
<td><code>new List&lt;string&gt; { "1ri6UZpjPLmTCswIXZ6Uq1" }</code></td>
</tr>
</tbody>
</table>
<p>Returns a <strong>ErrorResponse</strong> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">ErrorResponse response = _spotify.ReplacePlaylistTracks(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;, new List&lt;string&gt; { &quot;1ri6UZpjPLmTCswIXZ6Uq1&quot; });
if(!response.HasError())
Console.WriteLine(&quot;success&quot;);
</code></pre>
<hr />
<h2 id="removeplaylisttracks">RemovePlaylistTracks</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Remove one or more tracks from a users playlist.</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistId</td>
<td>The Spotify ID for the playlist.</td>
<td><code>"1TtEejT1y4D1WmcOnLfha2"</code></td>
</tr>
<tr>
<td>uris</td>
<td>array of objects containing Spotify URI strings (and their position in the playlist). A maximum of 100 objects can be sent at once.</td>
<td><code>(example below)</code></td>
</tr>
</tbody>
</table>
<p>Returns a <strong>ErrorResponse</strong> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">//Remove multiple tracks
ErrorResponse playlist = _spotify.RemovePlaylistTracks(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;, new List&lt;DeleteTrackUri&gt;()
{
new DeleteTrackUri(&quot;1ri6UZpjPLmTCswIXZ6Uq1&quot;),
new DeleteTrackUri(&quot;47xtGU3vht7mXLHqnbaau5&quot;)
});
//Remove multiple tracks at their specified positions
ErrorResponse playlist = _spotify.RemovePlaylistTracks(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;, new List&lt;DeleteTrackUri&gt;()
{
new DeleteTrackUri(&quot;1ri6UZpjPLmTCswIXZ6Uq1&quot;, 2),
new DeleteTrackUri(&quot;47xtGU3vht7mXLHqnbaau5&quot;, 0, 50)
});
</code></pre>
<hr />
<h2 id="removeplaylisttrack">RemovePlaylistTrack</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Remove one or more tracks from a users playlist.</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistId</td>
<td>The Spotify ID for the playlist.</td>
<td><code>"1TtEejT1y4D1WmcOnLfha2"</code></td>
</tr>
<tr>
<td>uri</td>
<td>Spotify URI</td>
<td><code>new DeleteTrackUri("1ri6UZpjPLmTCswIXZ6Uq1")</code></td>
</tr>
</tbody>
</table>
<p>Returns a <strong>ErrorResponse</strong> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">//Remove all tracks with the specified URI
ErrorResponse response = _spotify.RemovePlaylistTrack(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;, new DeleteTrackUri(&quot;1ri6UZpjPLmTCswIXZ6Uq1&quot;));
//Remove all tracks with the specified URI and the specified positions
ErrorResponse response = _spotify.RemovePlaylistTrack(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;, new DeleteTrackUri(&quot;1ri6UZpjPLmTCswIXZ6Uq1&quot;, 0, 10, 20));
</code></pre>
<hr />
<h2 id="addplaylisttracks">AddPlaylistTracks</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Add one or more tracks to a users playlist.</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistId</td>
<td>The Spotify ID for the playlist.</td>
<td><code>"1TtEejT1y4D1WmcOnLfha2"</code></td>
</tr>
<tr>
<td>uris</td>
<td>A list of Spotify track URIs to add</td>
<td><code>new List&lt;string&gt; { "1ri6UZpjPLmTCswIXZ6Uq1" }</code></td>
</tr>
<tr>
<td>[position]</td>
<td>The position to insert the tracks, a zero-based index</td>
<td><code>10</code></td>
</tr>
</tbody>
</table>
<p>Returns a <strong>ErrorResponse</strong> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">ErrorResponse response = _spotify.AddPlaylistTracks(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;, new List&lt;string&gt; { &quot;1ri6UZpjPLmTCswIXZ6Uq1&quot; });
if(!response.HasError())
Console.WriteLine(&quot;Success&quot;);
</code></pre>
<hr />
<h2 id="addplaylisttrack">AddPlaylistTrack</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Add one or more tracks to a users playlist.</p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistId</td>
<td>The Spotify ID for the playlist.</td>
<td><code>"1TtEejT1y4D1WmcOnLfha2"</code></td>
</tr>
<tr>
<td>uri</td>
<td>A Spotify Track URI</td>
<td><code>"1ri6UZpjPLmTCswIXZ6Uq1"</code></td>
</tr>
<tr>
<td>position</td>
<td>The position to insert the tracks, a zero-based index</td>
<td><code>10</code></td>
</tr>
</tbody>
</table>
<p>Returns a <strong>ErrorResponse</strong> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">ErrorResponse response = _spotify.AddPlaylistTrack(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;, &quot;1ri6UZpjPLmTCswIXZ6Uq1&quot;);
if(!response.HasError())
Console.WriteLine(&quot;Success&quot;);
</code></pre>
<hr />
<h2 id="reorderplaylist">ReorderPlaylist</h2>
<p><span class="label label-warning">AUTH REQUIRED</span></p>
<blockquote>
<p>Reorder a track or a group of tracks in a playlist.
More Info: <a href="https://developer.spotify.com/web-api/reorder-playlists-tracks/">Reorder-Playlist</a></p>
</blockquote>
<p><strong>Paramters</strong> </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td>The user's Spotify user ID.</td>
<td><code>"1122095781"</code></td>
</tr>
<tr>
<td>playlistId</td>
<td>The Spotify ID for the playlist.</td>
<td><code>"1TtEejT1y4D1WmcOnLfha2"</code></td>
</tr>
<tr>
<td>rangeStart</td>
<td>The position of the first track to be reordered.</td>
<td><code>2</code></td>
</tr>
<tr>
<td>insertBefore</td>
<td>The position where the tracks should be inserted.</td>
<td><code>0</code></td>
</tr>
<tr>
<td>[rangeLength]</td>
<td>The amount of tracks to be reordered. Defaults to 1 if not set.</td>
<td><code>2</code></td>
</tr>
<tr>
<td>[snapshotId]</td>
<td>The playlist's snapshot ID against which you want to make the changes.</td>
<td>``</td>
</tr>
</tbody>
</table>
<p>Returns a <strong>Snapshot</strong>-Object which contains the property <code>String SnapshotId</code></p>
<p><strong>Usage</strong> </p>
<pre><code class="cs">Snapshot snapshot = _spotify.ReorderPlaylist(&quot;1122095781&quot;, &quot;1TtEejT1y4D1WmcOnLfha2&quot;, 2, 0, 2);
Console.WriteLine(&quot;New SnapshotId: &quot; + snapshot.SnapshotId);
</code></pre>
<hr /></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
<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>
<script src="../../highlight.js"></script>
</body>
</html>