Spotify.NET/SpotifyAPI.Docs/versioned_docs/version-5.1.1/web/albums.md

68 lines
2.5 KiB
Markdown
Raw Normal View History

2020-05-13 17:25:42 +01:00
---
id: albums
title: Albums
sidebar_label: Albums
---
2019-08-16 23:40:04 +01:00
## GetAlbumTracks
2016-08-20 11:49:09 +01:00
> Get Spotify catalog information about an album's tracks. Optional parameters can be used to limit the number of tracks returned.
2019-08-16 23:40:04 +01:00
**Parameters**
2016-08-20 11:49:09 +01:00
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|id| The Spotify ID for the album. | `"5O7V8l4SeXTymVp3IesT9C"`
|[limit]| The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. | `20`
|[offset]| The index of the first track to return. Default: 0 (the first object). | `0`
|[market]| An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. | `"DE"`
Returns a [SimpleTrack](https://developer.spotify.com/web-api/object-model/#track-object-simplified) wrapped inside a [Paging-object](https://developer.spotify.com/web-api/object-model/#paging-object)
2019-08-16 23:40:04 +01:00
**Usage**
2016-08-20 11:49:09 +01:00
2019-08-16 23:40:04 +01:00
```csharp
2016-08-20 11:49:09 +01:00
Paging<SimpleTrack> tracks = _spotify.GetAlbumTracks("5O7V8l4SeXTymVp3IesT9C");
tracks.Items.ForEach(item => Console.WriteLine(item.Name)); //Display all fetched Track-Names (max 20)
Console.WriteLine(tracks.Total.ToString()) //Display total album track count
```
---
2019-08-16 23:40:04 +01:00
## GetAlbum
2016-08-20 11:49:09 +01:00
> Get Spotify catalog information for a single album.
2019-08-16 23:40:04 +01:00
**Parameters**
2016-08-20 11:49:09 +01:00
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|id| The Spotify ID for the album. | `5O7V8l4SeXTymVp3IesT9C`
|[market]| An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. | `"DE"`
Returns a [FullAlbum](https://developer.spotify.com/web-api/object-model/#album-object-full)
2019-08-16 23:40:04 +01:00
**Usage**
```csharp
2016-08-20 11:49:09 +01:00
FullAlbum album = _spotify.GetAlbum("5O7V8l4SeXTymVp3IesT9C");
Console.WriteLine(album.Name + "| Popularity: " + album.Popularity); //Display name and Popularity
```
---
2019-08-16 23:40:04 +01:00
## GetSeveralAlbums
2016-08-20 11:49:09 +01:00
> Get Spotify catalog information for multiple albums identified by their Spotify IDs.
2019-08-16 23:40:04 +01:00
**Parameters**
2016-08-20 11:49:09 +01:00
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|ids| A list of the Spotify IDs for the albums. Maximum: 20 IDs. | `new List<String>() { "5O7V8l4SeXTymVp3IesT9C" }`
|[market]| An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. | `"DE"`
2019-08-16 23:40:04 +01:00
Returns a `SeveralAlbums` which Property "Albums" contains a list of [FullAlbum](https://developer.spotify.com/web-api/object-model/#album-object-full)
2016-08-20 11:49:09 +01:00
2019-08-16 23:40:04 +01:00
**Usage**
```csharp
2016-08-20 11:49:09 +01:00
SeveralAlbums albums = _spotify.GetSeveralAlbums(new List<String>() { "5O7V8l4SeXTymVp3IesT9C" });
Console.WriteLine(albums.Albums[0].Name);
```
---