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

40 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2020-05-13 17:25:42 +01:00
---
id: search
title: Search
sidebar_label: Search
---
2019-08-16 23:40:04 +01:00
## SearchItems
2016-08-20 11:49:09 +01:00
> Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string.
2019-08-16 23:40:04 +01:00
::: warning
You may want to use `SearchItemsEscaped` if you're processing user-input without validation
:::
**Parameters**
2016-08-20 11:49:09 +01:00
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|q| The search query's keywords (and optional field filters and operators), for example q=roadhouse+blues. | `"roadhouse+blues"`
|type| A list of item types to search across. | `SearchType.Album`
|[limit]| The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. | `20`
|[offset]| The index of the first result to return. Default: 0 | `0`
|[market]| An ISO 3166-1 alpha-2 country code or the string from_token. | `"de"`
2019-08-16 23:40:04 +01:00
Returns a `SearchItem` which contains the properties `Paging<FullArtist> Artists`,`Paging<FullTrack> Tracks`, `Paging<SimpleAlbum> Albums`, `Paging<SimplePlaylist> Playlists`. They are filled based on your search-type.
2016-08-20 11:49:09 +01:00
**Usage**
2019-08-16 23:40:04 +01:00
```csharp
2016-08-20 11:49:09 +01:00
SearchItem item = _spotify.SearchItems("roadhouse+blues", SearchType.Album | SearchType.Playlist);
Console.WriteLine(item.Albums.Total); //How many results are there in total? NOTE: item.Tracks = item.Artists = null
```
---
2019-08-16 23:40:04 +01:00
## SearchItemsEscaped
> Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string.
Works like `SearchItems`, but URL escapes all characters