Files
bookhoard/bruno/media-items/Field Values Search - Genres.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

90 lines
2.3 KiB
YAML

info:
name: Field Values Search - Genres
type: http
seq: 7
http:
method: GET
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&genre=sci&limit=50"
params:
- name: library_id
value: "{{library_id}}"
type: query
- name: genre
value: sci
type: query
- name: limit
value: "50"
type: query
auth: inherit
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Field Values Search - Genres
Fetches distinct genre values for autocomplete dropdowns with counts and similarity scores.
**Method:** GET
**Endpoint:** /api/media-items/search
**Authentication:** Required (Bearer token)
**Query Parameters:**
- `library_id` (string, required): Library UUID to search within
- `genre` (string, required): Genre name to search for (fuzzy match)
- `limit` (integer, optional): Maximum results to return (default: 50)
**How It Works:**
- Returns distinct genre names from the library
- Fuzzy matches the search query against genre names
- Includes count of books per genre
- Includes similarity score (0-1, higher = better match)
- Sorted by similarity score, then by count
**Use Case:**
- Populate autocomplete dropdown when user types in genre filter field
- Show user available genres with book counts
- Help users discover similar genre names
**Response:** HTTP 200 (OK)
```json
{
"results": [
{
"value": "Sci-Fi",
"count": 234,
"score": 0.85
},
{
"value": "Science Fiction",
"count": 156,
"score": 0.82
}
],
"total": 2
}
```
**Examples:**
- `genre=sci` → Returns "Sci-Fi" (234 books), "Science Fiction" (156 books)
- `genre=fant` → Returns "Fantasy" (345 books), "High Fantasy" (89 books)
- `genre=mystery` → Returns "Mystery" (123 books), "Mystery/Thriller" (45 books)
**Frontend Integration:**
- Call this endpoint when user types ≥2 characters in genre field
- Display results in `<datalist>` or custom dropdown
- Show: "Genre Name (count)" format
- Allow user to select from suggestions
**Success Criteria:**
- Status: 200
- Returns array of genre values with counts
- Results sorted by relevance (similarity score)
- Only returns genres matching the fuzzy search