Files
bookhoard/docs/developer/api/devices/get_device.md
T
John O'Keefe c4b62af213 docs(devices): Work Order 3 batch 1 — 6 missing device endpoints + gate entries
New frontmatter'd docs with handler-compatible examples:
- devices/get_device.md (DeviceInfo shape)
- devices/regenerate_device_token.md (token + sync_urls)
- devices/get_device_mappings.md (wrapper + DeviceMappingSummary)
- devices/update_device_mapping.md (UpdateDeviceMappingRequest)
- devices/download_sidecar_config.md (sidecar config JSON file)
- devices/link_book.md (LinkBookRequest; one UNVERIFIED marker on required-tag)

Schema registry: 6 new entries; DeviceMappingSummary hoisted to package
scope. Gate passes (the UNVERIFIED marker is logged, not a failure).

Excludes /api/devices-page (htmx page route, per ground rules).
2026-10-24 14:46:22 -04:00

43 lines
1.2 KiB
Markdown

---
method: GET
path: /api/devices/:id
auth: jwt
area: devices
---
<!-- source: internal/handlers/devices.go:306 DeviceHandler.GetDevice -->
# Get Device
Returns one device owned by the signed-in user. Device tokens are **not**
included in this response (use `regenerate-token` to obtain them).
## Example response
```json example-response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"device_name": "Kobo Clara",
"device_type": "kobo",
"last_sync": "2026-10-24T13:57:01Z",
"last_seen": "2026-10-24T13:57:01Z",
"sync_enabled": true,
"auto_sync": true,
"sync_frequency_minutes": 60,
"created_at": "2026-10-24T13:57:01Z",
"auth_token": ""
}
```
`last_sync` and `last_seen` are `*time.Time` → `null` when unset. `created_at`
is RFC3339 (`time.Time` marshaling). `device_metadata` is omitted when empty
(`omitempty`).
## Errors
| Status | Body | When |
| ------ | ---- | ---- |
| 400 | `{"error": "invalid user ID"}` / `{"error": "invalid device ID"}` | malformed id(s) |
| 401 | `{"error": "unauthorized"}` | no/invalid JWT |
| 403 | `{"error": "access denied"}` | device belongs to another user |
| 404 | `{"error": "device not found"}` | no such device |