Update configuration key naming convention to use snake_case consistently. Applies changes recursively across all subdirectories.
89 lines
2.1 KiB
Plaintext
89 lines
2.1 KiB
Plaintext
meta {
|
|
name: Get Device Usage
|
|
type: http
|
|
seq: 2
|
|
}
|
|
|
|
get {
|
|
url: {{base_url}}/api/analytics/device-usage
|
|
body: none
|
|
auth: inherit
|
|
}
|
|
|
|
tests {
|
|
test("status must be 200", function() {
|
|
expect(res.status).to.eql(200);
|
|
});
|
|
|
|
test("response has devices array", function() {
|
|
const body = JSON.parse(res.body);
|
|
expect(body).to.have.property("devices");
|
|
expect(body.devices).to.be.an("array");
|
|
});
|
|
|
|
test("devices have required fields", function() {
|
|
const body = JSON.parse(res.body);
|
|
if (body.devices.length > 0) {
|
|
expect(body.devices[0]).to.have.property("device_name");
|
|
expect(body.devices[0]).to.have.property("device_type");
|
|
expect(body.devices[0]).to.have.property("sync_count");
|
|
}
|
|
});
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
Get usage statistics for all devices.
|
|
|
|
**Endpoint**: GET /api/analytics/device-usage
|
|
**Auth**: Required (Bearer token)
|
|
|
|
## Response Fields
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| devices | array | List of device usage statistics |
|
|
| devices[].id | string | Device ID |
|
|
| devices[].device_name | string | Device name |
|
|
| devices[].device_type | string | Device type (kobo, kindle, koreader) |
|
|
| devices[].sync_count | int | Number of sync operations |
|
|
| devices[].last_sync | string | Last sync timestamp |
|
|
| devices[].total_reading_minutes | int | Total reading time on device |
|
|
| devices[].books_read | int | Number of books completed on device |
|
|
|
|
## Example Response
|
|
|
|
```json
|
|
{
|
|
"devices": [
|
|
{
|
|
"id": "789e4567-e89b-12d3-a456-426614174001",
|
|
"device_name": "My Kobo Clara",
|
|
"device_type": "kobo",
|
|
"sync_count": 45,
|
|
"last_sync": "2026-02-08T17:25:00Z",
|
|
"total_reading_minutes": 1250,
|
|
"books_read": 3
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## Error Responses
|
|
|
|
| Code | Description |
|
|
|------|-------------|
|
|
| 401 | Unauthorized |
|
|
| 500 | Internal server error |
|
|
|
|
## Notes
|
|
|
|
- Only shows devices registered to the authenticated user
|
|
- Devices are sorted by sync_count in descending order
|
|
- Includes both active and inactive devices
|
|
}
|