CategoriesAPI¶
- class minim.api.spotify.CategoriesAPI(client: APIClient, /)[source]¶
Bases:
SpotifyResourceAPICategories API endpoints for the Spotify Web API.
Important
This class is managed by
SpotifyWebAPIClientand should not be instantiated directly.- Parameters:
- clientminim.api._shared.APIClient
API client instance used to make HTTP requests.
Methods
Categories > Get Several Browse Categories: Get Spotify catalog information for available categories.
Categories > Get Single Browse Category: Get Spotify catalog information for a category.
- get_categories(*, locale: str | None = None, limit: int | None = None, offset: int | None = None) dict[str, Any][source]¶
Categories > Get Several Browse Categories: Get Spotify catalog information for available categories.
- Parameters:
- localestr; keyword-only; optional
IETF BCP 47 language tag consisting of an ISO 639-1 language code and an ISO 3166-1 alpha-2 country code joined by an underscore. If provided, categories are returned in the specified language.
Note
If a locale identifier is not supplied or the specified language is not available, categories will be returned in the Spotify default language (American English).
Example:
"es_MX"– Spanish (Mexico).- limitint; keyword-only; optional
Maximum number of categories to return.
Valid range:
1to50.API default:
20.- offsetint; keyword-only; optional
Index of the first category to return. Use with limit to get the next batch of categories.
Minimum value:
0.API default:
0.
- Returns:
- categoriesdict[str, Any]
Page of Spotify metadata for the available categories.
Sample response
{ "categories": { "href": <str>, "items": [ { "href": <str>, "icons": [ { "height": <int>, "url": <str>, "width": <int> } ], "id": <str>, "name": <str> } ], "limit": <int>, "next": <str>, "offset": <int>, "previous": <int>, "total": <int> } }
- get_category(category_id: str, /, *, locale: str | None = None) dict[str, Any][source]¶
Categories > Get Single Browse Category: Get Spotify catalog information for a category.
- Parameters:
- category_idstr; positional-only
Spotify category ID.
Examples:
"dinner","party".- localestr; keyword-only; optional
IETF BCP 47 language tag consisting of an ISO 639-1 language code and an ISO 3166-1 alpha-2 country code joined by an underscore. If provided, categories are returned in the specified language.
Note
If a locale identifier is not supplied or the specified language is not available, categories will be returned in the Spotify default language (American English).
Example:
"es_MX"– Spanish (Mexico).
- Returns:
- categorydict[str, Any]
Spotify metadata for the category.
Sample response
{ "href": <str>, "icons": [ { "height": <int>, "url": <str>, "width": <int> } ], "id": <str>, "name": <str> }