Files
bookhoard/bruno/media-items/Combined Search and Filters.yml
T
john-okeefe 74009f66b5 refactor: restructure Bruno API collection for consistency
Standardize all Bruno API request files with consistent formatting and
structure to improve maintainability and readability.

Changes include:
- Consolidate URL parameters into main URL instead of separate definitions
- Standardize quote style (double quotes throughout)
- Add proper settings section with defaults (timeout, redirects, etc.)
- Improve YAML formatting with literal style for multi-line content
- Remove redundant fields (disabled: false)
- Clean up header and body structure
- Update sequence numbers for better organization
- Add scenarios folder structure for organized test groupings

Removes obsolete Search Invalid Library ID test case.

Environment configuration updated with new library_id for testing.

These changes improve the Bruno collection's maintainability and make
it easier to create new API requests following established patterns.
2026-03-25 18:03:00 -04:00

91 lines
2.5 KiB
YAML

info:
name: Combined Search and Filters
type: http
seq: 1
http:
method: GET
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&q=foundation&author_filter=asimov&genre_filter=scifi&year_min=1950&year_max=2000&sort=title ASC"
params:
- name: library_id
value: "{{library_id}}"
type: query
- name: q
value: foundation
type: query
- name: author_filter
value: asimov
type: query
- name: genre_filter
value: scifi
type: query
- name: year_min
value: "1950"
type: query
- name: year_max
value: "2000"
type: query
- name: sort
value: title ASC
type: query
auth: inherit
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Combined Search and Filters
Combines a search query with multiple filters to find specific media items.
**Method:** GET
**Endpoint:** /api/media-items/search
**Authentication:** Required (Bearer token)
**Query Parameters:**
- `library_id` (string, required): Library UUID to search within
- `q` (string, required): Search query for title/author/series/tags (fuzzy match)
- `author_filter` (string, optional): Fuzzy match author field
- `genre_filter` (string, optional): Fuzzy match genre field
- `year_min` (integer, optional): Minimum copyright year (exact match)
- `year_max` (integer, optional): Maximum copyright year (exact match)
- `sort` (string, optional): Sort order (e.g., "title ASC", "author DESC", "created_at DESC")
**How Combined Search Works:**
- All filters are AND'd together (must match ALL conditions)
- Search query (`q`) uses fuzzy matching across title, author, series, tags
- Text filters (author, genre) use fuzzy matching
- Year filters use exact range matching
- Results sorted by relevance first, then by sort parameter
**Response:** HTTP 200 (OK)
```json
[
{
"id": "uuid",
"title": "Foundation",
"author": "Asimov, Isaac",
"genre": "Sci-Fi",
"copyright_year": 1951,
"library_id": "uuid",
"library_name": "E-Books"
}
]
```
**Example Use Cases:**
- Find "Foundation" by "Asimov" in "Sci-Fi" genre from 1950-2000
- Search "potter" with genre "fantasy" published after 2000
- Find "mars" books by "sci-fi" authors sorted by date
**Success Criteria:**
- Status: 200
- Returns items matching all filters
- Results sorted by relevance then by sort parameter
- Only returns items matching ALL specified conditions