Fix critical bug where library_id variable was not quoted in the request
body, causing invalid JSON that was rejected by the API parser.
Changes:
- Quote library_id variable: {{library_id}} → "{{library_id}}"
- Add explicit Content-Type header
- Update request body format to use proper YAML multi-line string
Root Cause:
- Unquoted UUID in JSON: {"library_id": 551ac19c-896a-...}
- Produced invalid JSON that failed c.Bind() in scanner handler
- Handler returned 400 "invalid request" error
Impact:
- Bruno requests for scanning now work correctly
- API scan endpoint accepts request successfully
- Enables proper testing of scan functionality via Bruno
Testing:
- Verified scan request completes successfully
- Job ID returned correctly
- Scanner processes files as expected
File: bruno/scanner/Scan Media Items.yml
51 lines
1.1 KiB
YAML
51 lines
1.1 KiB
YAML
info:
|
|
name: Scan Media Items (Background)
|
|
type: http
|
|
seq: 1
|
|
|
|
http:
|
|
method: POST
|
|
url: "{{base_url}}/api/scanner/scan"
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
params:
|
|
- name: ""
|
|
value: ""
|
|
type: query
|
|
body:
|
|
type: json
|
|
data: |-
|
|
{
|
|
"library_id": "{{library_id}}"
|
|
}
|
|
auth: inherit
|
|
|
|
settings:
|
|
encodeUrl: true
|
|
timeout: 0
|
|
followRedirects: true
|
|
maxRedirects: 5
|
|
|
|
docs: |-
|
|
## Scan Media Items (Background)
|
|
|
|
Triggers an asynchronous media items scanning operation. The scan runs in the background and can be monitored using the job ID.
|
|
|
|
**Method:** POST
|
|
|
|
**Endpoint:** /api/scanner/scan
|
|
|
|
**Authentication:** Required (Bearer token, Admin only)
|
|
|
|
**Request Body:**
|
|
- `folder_paths` (array of strings, required): List of folder paths to scan
|
|
- Example: `["/path/to/media", "/another/path"]`
|
|
|
|
**Response:** HTTP 202 (Accepted)
|
|
```json
|
|
{
|
|
"message": "scan job enqueued",
|
|
"job_id": "550e8400-e29b-41d4-a716-446655440000",
|
|
"status": "pending"
|