meta { name: Get Library Stats type: http seq: 5 } get { url: {{base_url}}/api/libraries/{{library_id}}/stats body: none auth: inherit } headers { Content-Type: application/json } tests { test_get_library_stats_success(status, headers, body) { if (status !== 200) { throw new Error("Expected status 200, got " + status); } const contentType = headers["content-type"]; if (!contentType || !contentType.includes("application/json")) { throw new Error("Expected content-type to contain application/json, got " + contentType); } let data; try { data = JSON.parse(body); } catch (e) { throw new Error("Response body is not valid JSON"); } if (!data || typeof data !== "object") { throw new Error("Expected stats object in response"); } // Expected fields (verify they exist) const expectedFields = ["total_items", "total_size", "scanned_at"]; for (const field of expectedFields) { if (!(field in data)) { console.warn("Stats field '" + field + "' is missing from response"); } } return true; } } vars:pre-request { libraryId: "cc23d3a7-f8fb-451a-a78d-2a16df1b725a" } settings { encodeUrl: true timeout: 0 } docs { ## Get Library Stats Retrieves statistical information about a library's media items. **Method:** GET **Endpoint:** /api/libraries/{id}/stats **Authentication:** Required (Bearer token, admin only) **Path Parameters:** - `id` (string): Library UUID **Response:** Stats object - `total_items` (number): Total media items in library - `total_size` (number): Total file size in bytes - `scanned_at` (string): Last scan timestamp - Additional fields may be included **Status Codes:** - 200: Success - 400: Invalid library ID - 401: Unauthorized - 403: Forbidden (admin access required) - 404: Library not found - 500: Internal server error **Examples:** - Get library stats: `GET /api/libraries/cc23c3a7-f8fb-451a-a78d-2a16df1b725a/stats` **Note:** Admin access required - only users with admin role can access library statistics. }