@@ -165,6 +165,8 @@ Manage a **single device** by its MAC address. Operations include retrieval, upd
165165* ** POST** ` /device/<mac>/update-column `
166166 Update one specific column for a device.
167167
168+ Allowed ` columnName ` values: ` devName ` , ` devOwner ` , ` devType ` , ` devVendor ` , ` devGroup ` , ` devLocation ` , ` devComments ` , ` devIcon ` , ` devFavorite ` , ` devAlertEvents ` , ` devAlertDown ` , ` devCanSleep ` , ` devSkipRepeated ` , ` devReqNicsOnline ` , ` devForceStatus ` , ` devParentMAC ` , ` devParentPort ` , ` devParentRelType ` , ` devSSID ` , ` devSite ` , ` devVlan ` , ` devStaticIP ` , ` devIsNew ` , ` devIsArchived ` , ` devCustomProps ` .
169+
168170** Request Body** :
169171
170172``` json
@@ -190,6 +192,108 @@ Manage a **single device** by its MAC address. Operations include retrieval, upd
190192
191193---
192194
195+ ## 8. Lock / Unlock a Device Field
196+
197+ * ** POST** ` /device/<mac>/field/lock `
198+ Lock a field to prevent plugin overwrites, or unlock it to allow overwrites again.
199+
200+ ** Request Body** :
201+
202+ ``` json
203+ {
204+ "fieldName" : " devName" ,
205+ "lock" : true
206+ }
207+ ```
208+
209+ | Field | Type | Required | Description |
210+ | ---| ---| ---| ---|
211+ | ` fieldName ` | string | ✅ | Field to lock/unlock (e.g. ` devName ` , ` devVendor ` ) |
212+ | ` lock ` | boolean | ❌ | ` true ` to lock (default), ` false ` to unlock |
213+
214+ ** Response** (success):
215+
216+ ``` json
217+ {
218+ "success" : true ,
219+ "fieldName" : " devName" ,
220+ "locked" : true ,
221+ "message" : " Field devName locked"
222+ }
223+ ```
224+
225+ ** Error Responses** :
226+
227+ * Field does not support locking → HTTP 400
228+ * Unauthorized → HTTP 403
229+
230+ ---
231+
232+ ## 9. Unlock / Clear Device Fields (Bulk)
233+
234+ * ** POST** ` /devices/fields/unlock `
235+ Unlock fields (clear ` LOCKED ` /` USER ` sources) for one device, a list of devices, or all devices.
236+
237+ ** Request Body** :
238+
239+ ``` json
240+ {
241+ "mac" : " AA:BB:CC:DD:EE:FF" ,
242+ "fields" : [" devName" , " devVendor" ],
243+ "clearAll" : false
244+ }
245+ ```
246+
247+ | Field | Type | Required | Description |
248+ | ---| ---| ---| ---|
249+ | ` mac ` | string or array | ❌ | Single MAC, list of MACs, or omit for all devices |
250+ | ` fields ` | array of strings | ❌ | Fields to unlock. Omit to unlock all tracked fields |
251+ | ` clearAll ` | boolean | ❌ | ` true ` clears all sources; ` false ` (default) clears only ` LOCKED ` /` USER ` |
252+
253+ ** Response** (success):
254+
255+ ``` json
256+ {
257+ "success" : true
258+ }
259+ ```
260+
261+ ** Error Responses** :
262+
263+ * ` fields ` is not a list → HTTP 400
264+ * Unauthorized → HTTP 403
265+
266+ ---
267+
268+ ## 10. Set Device Alias
269+
270+ * ** POST** ` /device/<mac>/set-alias `
271+ Convenience wrapper to update the device display name (` devName ` ).
272+
273+ ** Request Body** :
274+
275+ ``` json
276+ {
277+ "alias" : " My Router"
278+ }
279+ ```
280+
281+ ** Response** (success):
282+
283+ ``` json
284+ {
285+ "success" : true
286+ }
287+ ```
288+
289+ ** Error Responses** :
290+
291+ * Missing ` alias ` → HTTP 400
292+ * Device not found → HTTP 404
293+ * Unauthorized → HTTP 403
294+
295+ ---
296+
193297## Example ` curl ` Requests
194298
195299** Get Device Details** :
@@ -233,3 +337,30 @@ curl -X POST "http://<server_ip>:<GRAPHQL_PORT>/device/AA:BB:CC:DD:EE:FF/update-
233337 --data ' {"columnName":"devName","columnValue":"Updated Device"}'
234338```
235339
340+ ** Lock a Field** :
341+
342+ ``` bash
343+ curl -X POST " http://<server_ip>:<GRAPHQL_PORT>/device/AA:BB:CC:DD:EE:FF/field/lock" \
344+ -H " Authorization: Bearer <API_TOKEN>" \
345+ -H " Content-Type: application/json" \
346+ --data ' {"fieldName":"devName","lock":true}'
347+ ```
348+
349+ ** Unlock Fields (all devices)** :
350+
351+ ``` bash
352+ curl -X POST " http://<server_ip>:<GRAPHQL_PORT>/devices/fields/unlock" \
353+ -H " Authorization: Bearer <API_TOKEN>" \
354+ -H " Content-Type: application/json" \
355+ --data ' {"fields":["devName","devVendor"]}'
356+ ```
357+
358+ ** Set Device Alias** :
359+
360+ ``` bash
361+ curl -X POST " http://<server_ip>:<GRAPHQL_PORT>/device/AA:BB:CC:DD:EE:FF/set-alias" \
362+ -H " Authorization: Bearer <API_TOKEN>" \
363+ -H " Content-Type: application/json" \
364+ --data ' {"alias":"My Router"}'
365+ ```
366+
0 commit comments