Update test environment and request files to use different test data: - Update job_id variable to new test job UUID - Change search test queries from Foundation/Asimov to 1984/Orwell - Change series search from Foundation to Haley - Add force parameter to scanner test These updates provide fresh test data for API testing and demonstrate search functionality with different media items.
75 lines
1.7 KiB
YAML
75 lines
1.7 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}}",
|
|
"force": true
|
|
}
|
|
auth: inherit
|
|
|
|
runtime:
|
|
scripts:
|
|
- type: after-response
|
|
code: |-
|
|
function onResponse(res) {
|
|
try {
|
|
const responseBody = res.getBody();
|
|
const job_id = responseBody.job_id;
|
|
|
|
if (job_id) {
|
|
bru.setEnvVar("job_id", job_id, { persist: true });
|
|
console.log("Access job_id saved:", job_id);
|
|
}
|
|
|
|
if (!job_id) {
|
|
console.log("No job_ids found in response.");
|
|
}
|
|
} catch (error) {
|
|
console.error("Error in post-response script:", error.message);
|
|
}
|
|
}
|
|
onResponse(res);
|
|
|
|
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"
|