docs(attributes): unified attribute-request API across MQTT/HTTP/CoAP/gateway - #529
Open
ShvaykaD wants to merge 8 commits into
Open
docs(attributes): unified attribute-request API across MQTT/HTTP/CoAP/gateway#529ShvaykaD wants to merge 8 commits into
ShvaykaD wants to merge 8 commits into
Conversation
…HTTP/CoAP - device & gateway MQTT, HTTP, CoAP attribute-request pages, plus edge mirrors - document fetch-all per scope (MQTT: empty value; HTTP/CoAP: allClientKeys/allSharedKeys) - replace non-working mosquitto sub/pub request examples with mqtt.js emulators - fix invalid gateway client/shared array example; deprecate legacy client/key/keys - add request-parameter tables; remove stale 'overlapping keys' note - all examples verified against a live instance
17 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the ThingsBoard documentation to describe a unified attribute-request API behavior across MQTT/HTTP/CoAP and the Gateway API, including “fetch all” semantics and scope-separated responses, and adds runnable Node/mqtt.js example scripts referenced from the docs.
Changes:
- Documented per-scope “fetch all” behavior (
""for MQTT/Gateway keys,allClientKeys/allSharedKeysfor HTTP/CoAP) and clarified scope exclusion rules. - Updated Gateway attribute request/response docs to use
clientKeys/sharedKeysand describe scope-separated responses. - Added downloadable mqtt.js scripts for device and gateway attribute requests and linked them from the docs.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/content/_includes/docs/reference/mqtt-api/attributes.mdx | Adds field semantics and a mqtt.js example for MQTT attribute requests. |
| src/content/_includes/docs/reference/http-api/attributes.mdx | Clarifies HTTP attribute read endpoint and adds allClientKeys/allSharedKeys parameters. |
| src/content/_includes/docs/reference/coap-api/attributes.mdx | Clarifies CoAP attribute read endpoint and adds allClientKeys/allSharedKeys parameters. |
| src/content/_includes/docs/reference/gateway-api/attributes.mdx | Updates Gateway attribute request docs to clientKeys/sharedKeys, scope-separated response, and adds mqtt.js example. |
| src/content/_includes/docs/edge/reference/apis-and-sdks/mqtt-api.mdx | Mirrors unified MQTT attribute-request semantics for Edge docs and adds an additional example. |
| src/content/_includes/docs/edge/reference/apis-and-sdks/http-api.mdx | Notes Edge HTTP “get attributes” supports allClientKeys/allSharedKeys. |
| src/content/_includes/docs/edge/reference/apis-and-sdks/coap-api.mdx | Notes Edge CoAP “get attributes” supports allClientKeys/allSharedKeys. |
| src/content/_includes/docs/edge/reference/apis-and-sdks/gateway-mqtt-api.mdx | Updates Edge gateway MQTT attribute request docs and adds a Node/mqtt.js example. |
| src/content/_includes/docs/edge/reference/apis-and-sdks/device-api.mdx | Adds short MQTT attribute-request guidance for Edge Device/Gateway topics. |
| public/resources/docs/reference/mqtt-api/mqtt-js-attributes-request.js | Adds a downloadable mqtt.js script for device attribute requests. |
| public/resources/docs/reference/gateway-api/mqtt-js-gateway-attributes-request.js | Adds a downloadable mqtt.js script for gateway attribute requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…attribute-request
…attribute-request # Conflicts: # src/content/_includes/docs/reference/coap-api/attributes.mdx # src/content/_includes/docs/reference/gateway-api/attributes.mdx
…I example Follow-up to the main merge, driven by testing the documented commands against a live instance. - MQTT device: restore the mqtt.js example. mosquitto_rr cannot be used here — ThingsBoard only accepts a subscription to v1/devices/me/attributes/response/+ (MqttTransportHandler switches on the exact topic), and mosquitto_rr rejects a wildcard response topic. Add the npm install prerequisite, matching mqtt-api/rpc.mdx. - All four pages: tabs per scope combination (specific keys, all client, all shared, all attributes), each carrying both the request and the response for that case. CoAP shows the Access Token and X.509 commands inside every tab instead of a single detached block. - HTTP and CoAP: document the no-parameters default and add allClientKeys/allSharedKeys examples (PROD-8496 QA comments). - Gateway: the legacy scope collision only happens when both scopes come back at once — with explicit keys a single scope is queried and no collision occurs. Verified on a live gateway session. - Gateway: use version strings that survive JSON_TYPE_CAST_ENABLED (on by default), which turns "1.0" into the number 1.0.
The Edge gateway MQTT API page was missed when the other pages were corrected after testing against a live instance. - Replace the Node.js/mqtt.js example with mosquitto_rr. The page claimed a command-line example was impossible because subscribe and publish must share one MQTT session; mosquitto_rr does exactly that, and the gateway response topic needs no wildcard, so it works. Verified on a live gateway session. - A scope is absent from the response whenever it returned nothing, not only when it was not requested. - Use version strings that survive JSON_TYPE_CAST_ENABLED.
…efault on Edge - Gateway: a scope is absent from the response whenever it returned nothing, not only when it was not requested. Brings the page in line with the other attribute pages, which were already corrected. - Edge HTTP and CoAP: state that a request without query parameters returns both scopes in full (PROD-8496 QA comments).
Verified against PE 4.4: the legacy fetch-all path applies the single-vs-multiple rule to each scope independently, so a response can carry `values` for the client scope and `value` for the shared one at the same time. Both examples are verbatim responses from that run.
- Rename to "request/response format": the response shape differs too, not just the request fields. - Replace the list of shortcomings with a plain description of what the format does, plus one sentence on what clientKeys/sharedKeys adds. - Drop the empty-keys paragraph and its example. The field table already requires key or keys, so that path is outside the documented contract. - Keep the deprecation notice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Documents the unified attribute-request API introduced in thingsboard/thingsboard#15865:
clientKeys/sharedKeysvalue returns the whole scope; HTTP/CoAP:allClientKeys=true/allSharedKeys=truequery params; Gateway: a request carrying only{id, device}returns both scopes.{"client": {...}, "shared": {...}}(the legacyvalue/valuesform is preserved and noted as deprecated).mqtt.jsNode emulator so they actually run end to end.Pages updated
docs/reference/{mqtt-api,http-api,coap-api,gateway-api}/attributes.mdxdocs/edge/reference/apis-and-sdks/{mqtt-api,http-api,coap-api,gateway-mqtt-api,device-api}.mdx_includes/.../mqtt-js-attributes-request.js,mqtt-js-gateway-attributes-request.jsRelated