You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/API_DEVICE.md
+142-3Lines changed: 142 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,10 @@ Manage a **single device** by its MAC address. Operations include retrieval, upd
50
50
***POST**`/device/<mac>`
51
51
Create or update a device record.
52
52
53
+
> ⚠️ **Full-replace (PUT) semantics.** Every editable field is written on each call. Any field omitted from the payload is reset to its default (empty string or `0`). This matches how the frontend edit form works — it always sends the complete device state.
54
+
>
55
+
> To update a **single field** without affecting others, use [`POST /device/<mac>/update-column`](#7-update-a-single-column) instead.
56
+
53
57
**Request Body**:
54
58
55
59
```json
@@ -62,8 +66,8 @@ Manage a **single device** by its MAC address. Operations include retrieval, upd
62
66
63
67
**Behavior**:
64
68
65
-
* If `createNew=true` → creates a new device
66
-
* Otherwise → updates existing device fields
69
+
* If `createNew=true` → inserts a new device row
70
+
* Otherwise → **replaces all editable fields** on the existing device
67
71
68
72
**Response**:
69
73
@@ -163,7 +167,13 @@ Manage a **single device** by its MAC address. Operations include retrieval, upd
163
167
## 7. Update a Single Column
164
168
165
169
***POST**`/device/<mac>/update-column`
166
-
Update one specific column for a device.
170
+
Update exactly one field for a device without touching any other fields.
171
+
172
+
> ✅ **Partial-update (PATCH) semantics.** Only the specified column is written. All other fields are left unchanged. Use this for automation, integrations, and any workflow that needs to update a single attribute.
173
+
>
174
+
> To replace all fields at once (e.g. saving from the edit form), use [`POST /device/<mac>`](#2-update-device-fields).
0 commit comments