@@ -210,7 +210,7 @@ config of a device,
210210
211211 curl -X PATCH \
212212 http://127.0.0.1:8000/api/v1/controller/device/76b7d9cc-4ffd-4a43-b1b0-8f8befd1a7c0/ \
213- -H ' authorization: Bearer dc8d497838d4914c9db9aad9b6ec66f6c36ff46b ' \
213+ -H ' authorization: Bearer <token> ' \
214214 -H ' content-type: application/json' \
215215 -d ' {
216216 "config": {
@@ -225,7 +225,7 @@ the/their {id} from the config of a device,
225225
226226 curl -X PATCH \
227227 http://127.0.0.1:8000/api/v1/controller/device/76b7d9cc-4ffd-4a43-b1b0-8f8befd1a7c0/ \
228- -H ' authorization: Bearer dc8d497838d4914c9db9aad9b6ec66f6c36ff46b ' \
228+ -H ' authorization: Bearer <token> ' \
229229 -H ' content-type: application/json' \
230230 -d ' {
231231 "config": {
@@ -240,7 +240,7 @@ from the config of a device,
240240
241241 curl -X PATCH \
242242 http://127.0.0.1:8000/api/v1/controller/device/76b7d9cc-4ffd-4a43-b1b0-8f8befd1a7c0/ \
243- -H ' authorization: Bearer dc8d497838d4914c9db9aad9b6ec66f6c36ff46b ' \
243+ -H ' authorization: Bearer <token> ' \
244244 -H ' cache-control: no-cache' \
245245 -H ' content-type: application/json' \
246246 -H ' postman-token: b3f6a1cc-ff13-5eba-e460-8f394e485801' \
@@ -465,7 +465,7 @@ command type being executed.
465465
466466 curl -X POST \
467467 http://127.0.0.1:8000/api/v1/controller/device/76b7d9cc-4ffd-4a43-b1b0-8f8befd1a7c0/command/ \
468- -H ' authorization: Bearer yoursecretauthtoken ' \
468+ -H ' authorization: Bearer <token> ' \
469469 -H ' content-type: application/json' \
470470 -d ' {
471471 "type": "custom",
@@ -481,6 +481,117 @@ Get Command Details
481481
482482 GET /api/v1/controller/device/{device_id}/command/{command_id}/
483483
484+ .. _controller_batch_command_api :
485+
486+ Dry-Run Mass Command
487+ ~~~~~~~~~~~~~~~~~~~~
488+
489+ .. code-block :: text
490+
491+ GET /api/v1/controller/batch-command/execute/
492+
493+ Returns the list of devices that would be targeted without executing
494+ anything. Useful for previewing which devices are affected.
495+
496+ **Query Parameters: **
497+
498+ ================ =========================================================
499+ Parameter Description
500+ ================ =========================================================
501+ ``organization `` Organization UUID (optional for superusers; set
502+ automatically when ``group `` or ``location `` is provided)
503+ ``type `` Command type (optional for dry-run)
504+ ``input `` JSON input data for the command (optional for dry-run).
505+ Encode as a URL-encoded JSON object, e.g.
506+ ``?type=custom&input=%7B%22command%22%3A%22uptime%22%7D ``
507+ ``devices `` Repeated ``devices `` query parameter, each a device UUID
508+ (optional; when provided, ``group `` and ``location `` are
509+ ignored)
510+ ``group `` Device group UUID (optional)
511+ ``location `` Location UUID (optional)
512+ ================ =========================================================
513+
514+ Execute a Mass Command
515+ ~~~~~~~~~~~~~~~~~~~~~~
516+
517+ .. code-block :: text
518+
519+ POST /api/v1/controller/batch-command/execute/
520+
521+ Creates and executes a batch command on the targeted devices.
522+
523+ **Request Parameters: **
524+
525+ ================ =========================================================
526+ Parameter Description
527+ ================ =========================================================
528+ ``organization `` Organization UUID (optional for superusers; set
529+ automatically when ``group `` or ``location `` is provided)
530+ ``type `` Type of command to execute (**required **)
531+ ``input `` Input data for the command (**conditionally required ** —
532+ depends on command type)
533+ ``label `` A short label to identify this batch command
534+ (**required **)
535+ ``notes `` Optional notes (optional)
536+ ``devices `` List of device UUIDs (optional; when provided, ``group ``
537+ and ``location `` are ignored)
538+ ``group `` Device group UUID (optional)
539+ ``location `` Location UUID (optional)
540+ ================ =========================================================
541+
542+ **Available Command Types: **
543+
544+ See :ref: `controller_execute_command_api ` for available command types and
545+ input formats.
546+
547+ **Example payload: **
548+
549+ .. code-block :: json
550+
551+ {
552+ "organization" : " org-uuid" ,
553+ "type" : " custom" ,
554+ "input" : {"command" : " uptime" },
555+ "label" : " Check uptime"
556+ }
557+
558+ **Example request: **
559+
560+ .. code-block :: shell
561+
562+ curl -X POST \
563+ http://127.0.0.1:8000/api/v1/controller/batch-command/execute/ \
564+ -H ' authorization: Bearer <token>' \
565+ -H ' content-type: application/json' \
566+ -d ' {
567+ "organization": "org-uuid",
568+ "type": "custom",
569+ "input": {"command": "uptime"},
570+ "label": "Check uptime"
571+ }'
572+
573+ **Response: ** ``201 Created `` with the batch command UUID.
574+
575+ List Mass Commands
576+ ~~~~~~~~~~~~~~~~~~
577+
578+ .. code-block :: text
579+
580+ GET /api/v1/controller/batch-command/
581+
582+ Returns a paginated list of batch commands with device count and skipped
583+ device information.
584+
585+ Get Mass Command Detail
586+ ~~~~~~~~~~~~~~~~~~~~~~~
587+
588+ .. code-block :: text
589+
590+ GET /api/v1/controller/batch-command/{id}/
591+
592+ Returns detailed information about a batch command, including the list of
593+ targeted devices.
594+
484595List Device Groups
485596~~~~~~~~~~~~~~~~~~
486597
@@ -603,7 +714,7 @@ You can create ``DeviceLocation`` object by using primary keys of existing
603714
604715 curl -X PUT \
605716 http://127.0.0.1:8000/api/v1/controller/device/8a85cc23-bad5-4c7e-b9f4-ffe298defb5c/location/ \
606- -H 'authorization: Bearer dc8d497838d4914c9db9aad9b6ec66f6c36ff46b ' \
717+ -H 'authorization: Bearer <token> ' \
607718 -H 'content-type: application/json' \
608719 -d '{
609720 "location": "f0cb5762-3711-4791-95b6-c2f6656249fa",
@@ -635,7 +746,7 @@ single request.
635746
636747 curl -X PUT \
637748 http://127.0.0.1:8000/api/v1/controller/device/8a85cc23-bad5-4c7e-b9f4-ffe298defb5c/location/ \
638- -H 'authorization: Bearer dc8d497838d4914c9db9aad9b6ec66f6c36ff46b ' \
749+ -H 'authorization: Bearer <token> ' \
639750 -H 'content-type: application/json' \
640751 -d '{
641752 "location": {
@@ -686,7 +797,7 @@ demonstrates creating both ``Location`` and ``FloorPlan`` objects.
686797
687798 curl -X PUT \
688799 http://127.0.0.1:8000/api/v1/controller/device/8a85cc23-bad5-4c7e-b9f4-ffe298defb5c/location/ \
689- -H 'authorization: Bearer dc8d497838d4914c9db9aad9b6ec66f6c36ff46b ' \
800+ -H 'authorization: Bearer <token> ' \
690801 -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
691802 -F 'location.name=Via del Corso' \
692803 -F 'location.address=Via del Corso, Roma, Italia' \
@@ -716,7 +827,7 @@ plan for that location using this endpoint.
716827
717828 curl -X PUT \
718829 http://127.0.0.1:8000/api/v1/controller/device/8a85cc23-bad5-4c7e-b9f4-ffe298defb5c/location/ \
719- -H 'authorization: Bearer dc8d497838d4914c9db9aad9b6ec66f6c36ff46b ' \
830+ -H 'authorization: Bearer <token> ' \
720831 -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
721832 -F location=f0cb5762-3711-4791-95b6-c2f6656249fa \
722833 -F floorplan.floor=1 \
@@ -907,7 +1018,7 @@ in a single request.
9071018
9081019 curl -X POST \
9091020 http://127.0.0.1:8000/api/v1/controller/location/ \
910- -H 'authorization: Bearer dc8d497838d4914c9db9aad9b6ec66f6c36ff46b ' \
1021+ -H 'authorization: Bearer <token> ' \
9111022 -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
9121023 -F 'name=Via del Corso' \
9131024 -F 'address=Via del Corso, Roma, Italia' \
0 commit comments