Search Controller Documentation
The SearchController
handles searching for tracks, albums,
and artists based on various filters and sorting criteria. See the
Search Guide for more info about filters and
sorting.
Controller Route: /api/search
All routes within the SearchController
are prefixed by
/api/search
.
Summary of Endpoints
Endpoint | Method | Description | Authorization |
---|---|---|---|
/api/search/tracks |
GET | Search for tracks based on filters and sorting. | Admin, User, Pass |
/api/search/albums |
GET | Search for albums based on filters and sorting. | Admin, User, Pass |
/api/search/artists |
GET | Search for artists based on filters and sorting. | Admin, User, Pass |
Search Tracks
Search for tracks based on a combination of AND and OR filters, with optional sorting.
Details:
- Endpoint:
/api/search/tracks
- Method:
GET
- Authorization: JWT (Roles: Admin, User, Pass)
Parameters:
- page (int, optional): The page number to retrieve (default is 0).
- count (int, optional): The number of tracks to return per page (default is 100).
-
andFilters (
List<string>
, optional): A list of filters that all must be satisfied (AND). -
orFilters (
List<string>
, optional): A list of filters where any must be satisfied (OR). -
sort (string, optional): The sorting order for the
results (default is
NameAsc
).
Responses:
- 200 OK: Returns a list of tracks matching the filters.
- 200 OK: Returns an empty list if no tracks are found.
Example Request (using curl
):
curl -X GET "https://your-api-url.com/api/search/tracks?page=0&count=50&andFilters=Genre;Eq;Rock&sort=NameAsc" \
-H "Authorization: Bearer <JWT-token>"
Search Albums
Search for albums based on a combination of AND and OR filters, with optional sorting.
Details:
- Endpoint:
/api/search/albums
- Method:
GET
- Authorization: JWT (Roles: Admin, User, Pass)
Parameters:
- page (int, optional): The page number to retrieve (default is 0).
- count (int, optional): The number of albums to return per page (default is 100).
-
andFilters (
List<string>
, optional): A list of filters that all must be satisfied (AND). -
orFilters (
List<string>
, optional): A list of filters where any must be satisfied (OR). -
sort (string, optional): The sorting order for the
results (default is
NameAsc
).
Responses:
- 200 OK: Returns a list of albums matching the filters.
- 200 OK: Returns an empty list if no albums are found.
Example Request (using curl
):
curl -X GET "https://your-api-url.com/api/search/albums?page=0&count=50&andFilters=Name;Contains;Good&sort=NameAsc" \
-H "Authorization: Bearer <JWT-token>"
Search Artists
Search for artists based on a combination of AND and OR filters, with optional sorting.
Details:
- Endpoint:
/api/search/artists
- Method:
GET
- Authorization: JWT (Roles: Admin, User, Pass)
Parameters:
- page (int, optional): The page number to retrieve (default is 0).
- count (int, optional): The number of artists to return per page (default is 100).
-
andFilters (
List<string>
, optional): A list of filters that all must be satisfied (AND). -
orFilters (
List<string>
, optional): A list of filters where any must be satisfied (OR). -
sort (string, optional): The sorting order for the
results (default is
NameAsc
).
Responses:
- 200 OK: Returns a list of artists matching the filters.
- 200 OK: Returns an empty list if no artists are found.
Example Request (using curl
):
curl -X GET "https://your-api-url.com/api/search/artists?page=0&count=50&andFilters=PlayCounts;Gt;10&sort=NameAsc" \
-H "Authorization: Bearer <JWT-token>"