From 157e9531208bab27388119b8a73259f65973f956 Mon Sep 17 00:00:00 2001 From: dshvaika Date: Wed, 24 Jun 2026 18:54:45 +0300 Subject: [PATCH] feat(attributes): HTTP allClientKeys/allSharedKeys params Additive boolean params for per-scope fetch-all; existing clientKeys/sharedKeys unchanged; all-wins over specific. --- .../server/transport/http/DeviceApiController.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common/transport/http/src/main/java/org/thingsboard/server/transport/http/DeviceApiController.java b/common/transport/http/src/main/java/org/thingsboard/server/transport/http/DeviceApiController.java index 73d77e2ddb..b933d97b97 100644 --- a/common/transport/http/src/main/java/org/thingsboard/server/transport/http/DeviceApiController.java +++ b/common/transport/http/src/main/java/org/thingsboard/server/transport/http/DeviceApiController.java @@ -144,17 +144,25 @@ public class DeviceApiController implements TbTransportService { @Parameter(description = "Comma separated key names for attribute with client scope", required = true , schema = @Schema(defaultValue = "state")) @RequestParam(value = "clientKeys", required = false, defaultValue = "") String clientKeys, @Parameter(description = "Comma separated key names for attribute with shared scope", required = true , schema = @Schema(defaultValue = "configuration")) - @RequestParam(value = "sharedKeys", required = false, defaultValue = "") String sharedKeys) { + @RequestParam(value = "sharedKeys", required = false, defaultValue = "") String sharedKeys, + @Parameter(description = "Set to true to return ALL client-scope attributes (ignores clientKeys)") + @RequestParam(value = "allClientKeys", required = false, defaultValue = "false") boolean allClientKeys, + @Parameter(description = "Set to true to return ALL shared-scope attributes (ignores sharedKeys)") + @RequestParam(value = "allSharedKeys", required = false, defaultValue = "false") boolean allSharedKeys) { DeferredResult responseWriter = new DeferredResult<>(); transportContext.getTransportService().process(DeviceTransportType.DEFAULT, ValidateDeviceTokenRequestMsg.newBuilder().setToken(deviceToken).build(), new DeviceAuthCallback(transportContext, responseWriter, sessionInfo -> { GetAttributeRequestMsg.Builder request = GetAttributeRequestMsg.newBuilder().setRequestId(0); List clientKeySet = !StringUtils.isEmpty(clientKeys) ? Arrays.asList(clientKeys.split(",")) : null; List sharedKeySet = !StringUtils.isEmpty(sharedKeys) ? Arrays.asList(sharedKeys.split(",")) : null; - if (clientKeySet != null) { + if (allClientKeys) { + request.setAllClientAttributes(true); + } else if (clientKeySet != null) { request.addAllClientAttributeNames(clientKeySet); } - if (sharedKeySet != null) { + if (allSharedKeys) { + request.setAllSharedAttributes(true); + } else if (sharedKeySet != null) { request.addAllSharedAttributeNames(sharedKeySet); } TransportService transportService = transportContext.getTransportService();