diff --git a/_data/host-constant.yml b/_data/host-constant.yml index ef0915c235..54cc307b31 100644 --- a/_data/host-constant.yml +++ b/_data/host-constant.yml @@ -10,7 +10,7 @@ hostLabel: localhost hostName: localhost mqttHostName: localhost - coapHostName: coap.thingsboard.cloud + coapHostName: localhost httpsUrl: https://thingsboard.cloud lwm2mHostName: lwm2m.thingsboard.cloud apiHostName: YOUR_SERVER_HOSTNAME diff --git a/_includes/docs/reference/coap-api.md b/_includes/docs/reference/coap-api.md index 1c05be323a..d39035b8ed 100644 --- a/_includes/docs/reference/coap-api.md +++ b/_includes/docs/reference/coap-api.md @@ -1,55 +1,81 @@ +{% if docsPrefix == nil or docsPrefix == "pe/" %} +{% assign HOST_NAME = "$THINGSBOARD_HOST_NAME" %} +{% endif %} +{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} +{% assign HOST_NAME = "$THINGSBOARD_EDGE_HOST_NAME" %} +{% endif %} + * TOC {:toc} -## Getting started - -### CoAP basics +[CoAP](https://en.wikipedia.org/wiki/Constrained_Application_Protocol){:target="_blank"} is a lightweight, UDP-based protocol designed for constrained IoT devices. +Although it follows a request–response model similar to HTTP, CoAP is optimized for low-power and low-bandwidth networks. +You can find more information about CoAP [here](https://tools.ietf.org/html/rfc7252){:target="_blank"}. -[CoAP](https://en.wikipedia.org/wiki/Constrained_Application_Protocol) is a light-weight IoT protocol for constrained devices. You can find more information about CoAP [here](https://tools.ietf.org/html/rfc7252). -CoAP protocol is UDP based, but similar to HTTP it uses request-response model. -CoAP Observe [Option](https://tools.ietf.org/html/rfc7641) allows subscription to resources and receiving notifications on resource change. +CoAP Observe [Option](https://tools.ietf.org/html/rfc7641){:target="_blank"} allows subscription to resources and receiving notifications on resource change. ThingsBoard server nodes act as a CoAP Server that supports both regular and observe requests. -### Client libraries setup +
-You can find CoAP client libraries for different programming languages on the web. The examples in this article will be based on [CoAP cli](https://www.npmjs.com/package/coap-cli). -In order to setup this tool on Linux or macOS, you can use the following command: +## Client libraries setup +Many CoAP client libraries are available for different platforms and languages. + +The examples in this guide are based on [CoAP cli](https://www.npmjs.com/package/coap-cli){:target="_blank"}, a command-line CoAP client. + +**Install CoAP CLI (Linux/macOS)** ```bash npm install coap-cli -g ``` {: .copy-code} {% capture difference %} -**NOTE**: -
-CoAP cli does not support query parameters. If you require to use query parameters, you should use [coap client](https://manpages.ubuntu.com/manpages/focal/man5/coap-client.5.html) instead. To install the coap-client please execute:
+**Note**: CoAP CLI does not support query parameters. If your use case requires query parameters, use [coap-client](https://manpages.ubuntu.com/manpages/focal/man5/coap-client.5.html){:target="_blank"} instead. {% endcapture %} {% include templates/info-banner.md content=difference %} -* **Ubuntu 20.04:** ```sudo apt install libcoap2-bin``` -* **Ubuntu 18.04:** ```sudo apt install libcoap1-bin``` +**Install coap-client** +- **Ubuntu 20.04+** + ```bash + sudo apt install libcoap2-bin + ``` + {: .copy-code} -### CoAP Authentication and error codes +- for **Ubuntu 18.04** + ```bash + sudo apt install libcoap1-bin + ``` + {: .copy-code} -In this article, we will use *access token* device credentials and they will be referred to later as **$ACCESS_TOKEN**. -The application needs to include **$ACCESS_TOKEN** as a path parameter into each CoAP request. -Possible error codes and their reasons: +
-* **4.00 Bad Request** - Invalid URL, request parameters or body. -* **4.01 Unauthorized** - Invalid **$ACCESS_TOKEN**. -* **4.04 Not Found** - Resource not found. +## Authentication methods -The alternative authentication option is to use [X.509 Certificates](/docs/{{docsPrefix}}user-guide/ssl/coap-x509-certificates/). +ThingsBoard supports two authentication mechanisms to secure COAP connections. + +**Supported methods**: +- [Access token](/docs/{{docsPrefix}}user-guide/ssl/coap-access-token/){:target="_blank"}. Uses a unique device access token included as a path parameter in each CoAP request. +- [X.509 certificates](/docs/{{docsPrefix}}user-guide/ssl/coap-x509-certificates/){:target="_blank"}. Uses digital certificates to authenticate devices and establish secure communication based on **public key infrastructure (PKI)**. + +> The examples in this guide use **access token–based authentication**. + +**Possible error codes and their reasons:** +- **4.00 Bad Request** - Invalid URL, parameters, or payload +- **4.01 Unauthorized** - Invalid **access token** +- **4.04 Not Found** - Requested resource does not exist + +
{% include templates/api/key-value-format.md %} -However, it is also possible to send data via [Protocol Buffers](https://developers.google.com/protocol-buffers). -Please refer to the [CoAP transport type](/docs/{{docsPrefix}}user-guide/device-profiles/#coap-transport-type) configuration section in device profile article for more details. +However, it is also possible to send data via [Protocol Buffers](https://developers.google.com/protocol-buffers){:target="_blank"}. +Please refer to the [CoAP transport type](/docs/{{docsPrefix}}user-guide/device-profiles/#coap-transport-type){:target="_blank"} configuration section in device profile article for more details. Using custom binary format or some serialization framework is also possible. See [protocol customization](#protocol-customization) for more details. +
+ ## Telemetry upload API In order to publish telemetry data to ThingsBoard server node, send POST request. @@ -86,22 +112,17 @@ In case your device is able to get the client-side timestamp, you can use follow {"ts":1451649600512, "values":{"key1":"value1", "key2":"value2"}} ``` -Where **1451649600512** is a [unix timestamp](https://en.wikipedia.org/wiki/Unix_time) with milliseconds precision. For example, the value '1451649600512' corresponds to 'Fri, 01 Jan 2016 12:00:00.512 GMT'. +Where **1451649600512** is a [unix timestamp](https://en.wikipedia.org/wiki/Unix_time){:target="_blank"} with milliseconds precision. For example, the value '1451649600512' corresponds to 'Fri, 01 Jan 2016 12:00:00.512 GMT'. -
+
Examples Below are examples of commands for publishing different types of telemetry data. -{% if docsPrefix == null or docsPrefix == "pe/" %} -Don't forget to replace $THINGSBOARD_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token. In this example, the hostname references your local installation. -{% endif %} -{% if docsPrefix contains "paas/" %} -Don't forget to replace $ACCESS_TOKEN with your device's access token. -{% endif %} -{% if docsPrefix == "edge/" %} -Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token. In this example, the hostname references your local installation. -{% endif %} +> ⚠️ Don't forget to replace {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN with your device's access token. -**Example 1**. Publish data as an object without timestamp (server-side timestamp will be used) using data from [**telemetry-data-as-object.json**](/docs/reference/resources/telemetry-data-as-object.json) file. +**Example 1**. +Publish data as an object without timestamp (server-side timestamp will be used) using data from [telemetry-data-as-object.json](/docs/reference/resources/telemetry-data-as-object.json){:target="_blank" download="telemetry-data-as-object.json"} file. {% capture tabspec %}coap-telemetry-upload A,Execute the command:,shell,resources/coap-telemetry.sh,/docs/reference/resources/coap-telemetry.sh{% endcapture %} @@ -124,7 +145,8 @@ The content of the JSON file: ``` {: .copy-code} -**Example 2**. Publish data as an array of objects without timestamp (server-side timestamp will be used) using data from [**telemetry-data-as-array.json**](/docs/reference/resources/telemetry-data-as-array.json) file. +**Example 2**. +Publish data as an array of objects without timestamp (server-side timestamp will be used) using data from [telemetry-data-as-array.json](/docs/reference/resources/telemetry-data-as-array.json){:target="_blank" download="telemetry-data-as-array.json"} file. {% capture tabspec %}coap-telemetry-upload-data-as-array A,Execute the command:,shell,resources/coap-telemetry-data-as-array.sh,/docs/reference/resources/coap-telemetry-data-as-array.sh{% endcapture %} @@ -137,7 +159,8 @@ The content of the JSON file: ``` {: .copy-code} -**Example 3**. Publish data as an object with timestamp (telemetry timestamp will be used) using data from [**telemetry-data-with-ts.json**](/docs/reference/resources/telemetry-data-with-ts.json) file. +**Example 3**. +Publish data as an object with timestamp (telemetry timestamp will be used) using data from [telemetry-data-with-ts.json](/docs/reference/resources/telemetry-data-with-ts.json){:target="_blank" download="telemetry-data-with-ts.json"} file. {% capture tabspec %}coap-telemetry-upload-data-with-ts A,Execute the command:,shell,resources/coap-telemetry-data-with-ts.sh,/docs/reference/resources/coap-telemetry-data-with-ts.sh{% endcapture %} @@ -165,13 +188,17 @@ The content of the JSON file: ``` {: .copy-code} +
+ ## Attributes API ThingsBoard attributes API allows devices to -* Upload [client-side](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types) device attributes to the server. -* Request [client-side](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types) and [shared](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types) device attributes from the server. -* Subscribe to [shared](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types) device attributes from the server. +* Upload [client-side](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types){:target="_blank"} device attributes to the server. +* Request [client-side](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types){:target="_blank"} and [shared](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types){:target="_blank"} device attributes from the server. +* Subscribe to [shared](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types){:target="_blank"} device attributes from the server. + +
### Publish attribute update to the server @@ -184,27 +211,7 @@ Access token%,%accesstoken%,%templates/api/coap/publish-attribute X.509 Certificate%,%certificate%,%templates/api/coap/publish-attribute-update-certificate.md{% endcapture %} {% include content-toggle.liquid content-toggle-id="coapPublishAttributeUpdate" toggle-spec=coapPublishAttributeUpdate %} -Publish client-side attributes update using data from [**new-attributes-values.json**](/docs/reference/resources/new-attributes-values.json) file. - -The content of the **"new-attributes-values.json"** file: - -```json -{ - "attribute1": "value1", - "attribute2": true, - "attribute3": 42.0, - "attribute4": 73, - "attribute5": { - "someNumber": 42, - "someArray": [1,2,3], - "someNestedObject": {"key": "value"} - } -} -``` - -{% capture tabspec %}coap-attributes-upload -A,Execute the command:,shell,resources/coap-attributes-publish.sh,/docs/reference/resources/coap-attributes-publish.sh{% endcapture %} -{% include tabs.html %} +
### Request attribute values from the server @@ -217,17 +224,6 @@ Access token%,%accesstoken%,%templates/api/coap/request-attribute X.509 Certificate%,%certificate%,%templates/api/coap/request-attribute-values-certificate.md{% endcapture %} {% include content-toggle.liquid content-toggle-id="coapRequestAttributeValues" toggle-spec=coapRequestAttributeValues %} -{% capture difference %} -**NOTE**: -
-This example shown with the coap-client instead of CoAP cli since CoAP cli does not support query parameters. Please refer to [Client libraries setup](#docsContent). -{% endcapture %} -{% include templates/info-banner.md content=difference %} - -{% capture tabspec %}coap-attributes-request -A,Execute the command:,shell,resources/coap-attributes-request.sh,/docs/reference/resources/coap-attributes-request.sh{% endcapture %} -{% include tabs.html %} - Result: ```shell @@ -242,6 +238,8 @@ However, it is still possible to have same keys for client, shared or even serve {% endcapture %} {% include templates/info-banner.md content=difference %} +
+ ### Subscribe to attribute updates from the server In order to subscribe to shared device attribute changes, send GET request with Observe option. @@ -253,22 +251,20 @@ Access token%,%accesstoken%,%templates/api/coap/subscribe-to-attr X.509 Certificate%,%certificate%,%templates/api/coap/subscribe-to-attribute-updates-certificate.md{% endcapture %} {% include content-toggle.liquid content-toggle-id="coapSubscribeToAttributeUpdates" toggle-spec=coapSubscribeToAttributeUpdates %} -Once shared attribute will be changed by one of the server-side components (REST API or Rule Chain) the client will receive the following update: - -{% capture tabspec %}coap-attributes-subscribe -A,Execute the command:,shell,resources/coap-attributes-subscribe.sh,/docs/reference/resources/coap-attributes-subscribe.sh{% endcapture %} -{% include tabs.html %} - Result: ```shell {"client":{"attribute1":"value1","attribute2":true}} ``` +
+ ## JSON value support {% include templates/api/json.md %} +
+ ## RPC API ### Server-side RPC @@ -282,6 +278,8 @@ Access token%,%accesstoken%,%templates/api/coap/server-side-rpc-a X.509 Certificate%,%certificate%,%templates/api/coap/server-side-rpc-certificate.md{% endcapture %} {% include content-toggle.liquid content-toggle-id="coapServerSideRPC" toggle-spec=coapServerSideRPC %} +
+ ### Client-side RPC In order to send RPC commands to the server, send POST request. @@ -293,9 +291,12 @@ Access token%,%accesstoken%,%templates/api/coap/client-side-rpc-a X.509 Certificate%,%certificate%,%templates/api/coap/client-side-rpc-certificate.md{% endcapture %} {% include content-toggle.liquid content-toggle-id="coapClientSideRPC" toggle-spec=coapClientSideRPC %} +
+ ## Claiming devices -Please see the corresponding article to get more information about the [Claiming devices](/docs/{{docsPrefix}}user-guide/claiming-devices) feature. +The Device Claiming feature allows end users to securely associate a device with their account after the device has been deployed and connected to ThingsBoard. +For a detailed explanation of the device claiming workflow and supported scenarios, refer to the {% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix contains "paas/" %}[Claiming devices](/docs/{{docsPrefix}}user-guide/claiming-devices){:target="_blank"}{% endif %}{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}[Claiming devices](/docs/user-guide/claiming-devices){:target="_blank"}{% endif %} documentation. In order to initiate claiming device, send POST request. @@ -320,28 +321,36 @@ In case the **durationMs** is not specified, the system parameter **device.claim {% endcapture %} {% include templates/info-banner.md content=difference %} +
+ ## Device provisioning -Please see the corresponding article to get more information about the [Device provisioning](/docs/{{docsPrefix}}user-guide/device-provisioning) feature. +Device provisioning allows devices to be registered dynamically without manual creation in the ThingsBoard UI. +For a detailed explanation of the provisioning process and supported scenarios, refer to the {% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix contains "paas/" %}[Device provisioning](/docs/{{docsPrefix}}user-guide/device-provisioning){:target="_blank"}{% endif %}{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}[Device provisioning](/docs/user-guide/device-provisioning){:target="_blank"}{% endif %} documentation. -In order to initiate device provisioning, send POST request to the following URL: +**Provisioning request** +To initiate device provisioning, send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/provision +coap://{{HOST_NAME}}/api/v1/provision ``` {: .copy-code} -Where **$THINGSBOARD_HOST_NAME** - your localhost, or the platform address. +Where **{{HOST_NAME}}** is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + {% endif %} {% if docsPrefix contains "paas/" %} + ```shell coap://{{coapHostName}}/api/v1/provision ``` {: .copy-code} + {% endif %} -The supported data format is: +**Request Payload** +The provisioning request must use the following JSON format: ```json { @@ -351,6 +360,15 @@ The supported data format is: } ``` +**Payload fields** +- **deviceName** — the name of the device to be provisioned. +- **provisionDeviceKey** — the provisioning key configured in ThingsBoard. +- **provisionDeviceSecret** — the provisioning secret associated with the provisioning key. + +If the provided credentials are valid, ThingsBoard automatically creates the device (if it does not already exist) and returns the device credentials, allowing the device to start communicating with the platform. + +
+ ## Firmware API Select the authentication method: @@ -360,9 +378,13 @@ Access token%,%accesstoken%,%templates/api/coap/firmware-api-acce X.509 Certificate%,%certificate%,%templates/api/coap/firmware-api-certificate.md{% endcapture %} {% include content-toggle.liquid content-toggle-id="coapFirmwareAPI" toggle-spec=coapFirmwareAPI %} +
+ ## Protocol customization -CoAP transport can be fully customized for specific use-case by changing the corresponding [module](https://github.com/thingsboard/thingsboard/tree/master/transport/coap). +CoAP transport can be fully customized for specific use-case by changing the corresponding [module](https://github.com/thingsboard/thingsboard/tree/master/transport/coap){:target="_blank"}. + +
## Next steps diff --git a/_includes/docs/reference/http-api.md b/_includes/docs/reference/http-api.md index 4e30e7b6a8..e859f60545 100644 --- a/_includes/docs/reference/http-api.md +++ b/_includes/docs/reference/http-api.md @@ -1,49 +1,65 @@ +{% if docsPrefix == nil or docsPrefix == "pe/" %} +{% assign HOST_NAME = "$THINGSBOARD_HOST_NAME" %} +{% endif %} +{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} +{% assign HOST_NAME = "$THINGSBOARD_EDGE_HOST_NAME" %} +{% endif %} * TOC {:toc} -## Getting started - -### HTTP basics - [HTTP](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol) is a general-purpose network protocol that can be used in IoT applications. You can find more information about HTTP [here](https://www.w3.org/Protocols/rfc2616/rfc2616.txt). HTTP protocol is TCP based and uses request-response model. ThingsBoard server nodes act as an HTTP Server that supports both HTTP and HTTPS protocols. -### Client libraries setup +
+ +## Client libraries setup + +Many HTTP client libraries are available for different platforms and languages. +The examples in this article will be based on [curl](https://en.wikipedia.org/wiki/CURL){:target="_blank"}. + +**Install curl for Linux** +```bash +sudo apt-get install curl +``` +{: .copy-code} + +> Starting with Windows 10 build 17063 and macOS 10.2 6C115 (Jaguar), cURL is available by default. -You can find HTTP client libraries for different programming languages on the web. The examples in this article will be based on [curl](https://en.wikipedia.org/wiki/CURL). -In order to setup this tool, you can use instructions in our [Hello World](/docs/{{docsPrefix}}getting-started-guides/helloworld/) guide. +
-### HTTP Authentication and error codes +## HTTP authentication method -In this article, we will use *access token* device credentials in this article and they will be referred to later as **$ACCESS_TOKEN**. -The application needs to include **$ACCESS_TOKEN** as a path parameter in each HTTP request. -Possible error codes and their reasons: +ThingsBoard supports [access token](/docs/user-guide/ssl/http-access-token/){:target="_blank"}-based authentication to secure HTTP connections. For each HTTP request, the client must include the access token as part of the request URL. -* **400 Bad Request** - Invalid URL, request parameters or body. -* **401 Unauthorized** - Invalid **$ACCESS_TOKEN**. -* **404 Not Found** - Resource not found. +> The examples in this guide use **access token–based authentication**. + +**Possible error codes and their reasons:** +- **400 Bad Request** - Invalid URL, request parameters or body +- **401 Unauthorized** - Invalid **access token** +- **404 Not Found** - Requested resource does not exist + +
{% include templates/api/key-value-format.md %} -Using custom binary format or some serialization framework is also possible. See [protocol customization](#protocol-customization) for more details. +Using custom binary format or some serialization framework is also possible. See [protocol customization](#protocol-customization){:target="_blank"} for more details. + +
## Telemetry upload API In order to publish telemetry data to ThingsBoard server node, send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry +http(s)://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/telemetry ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is running on; -- **$ACCESS_TOKEN** - device access token. {% endif %} {% if docsPrefix contains "paas/" %} @@ -52,10 +68,12 @@ Where ``` {: .copy-code} -Where **$ACCESS_TOKEN** - device access token. - {% endif %} +> ⚠️ Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is the device's access token. + The simplest supported data formats are: ```json @@ -76,43 +94,35 @@ In case your device is able to get the client-side timestamp, you can use follow {"ts":1451649600512, "values":{"key1":"value1", "key2":"value2"}} ``` -Where **1451649600512** is a [unix timestamp](https://en.wikipedia.org/wiki/Unix_time) with milliseconds precision. +Where **1451649600512** is a [unix timestamp](https://en.wikipedia.org/wiki/Unix_time){:target="_blank"} with milliseconds precision. For example, the value '1451649600512' corresponds to 'Fri, 01 Jan 2016 12:00:00.512 GMT'
Below are the examples of commands for publishing different types of telemetry data. -{% if docsPrefix == null or docsPrefix == "pe/" %} -Don't forget to replace $THINGSBOARD_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token. In this example, the hostname references your local installation. -{% endif %} -{% if docsPrefix contains "paas/" %} -Don't forget to replace $ACCESS_TOKEN with your device's access token. -{% endif %} -{% if docsPrefix == "edge/" %} -Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token. In this example, the hostname references your local installation. -{% endif %} +> ⚠️ Don't forget to replace {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is your device's access token. -**Example 1**. Publish data as an object without timestamp (server-side timestamp will be used). +**Example 1**. +Publish data as an object without timestamp (server-side timestamp will be used). Execute the command: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -curl -v -X POST --data "{"temperature":42,"humidity":73}" http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" +curl -v -X POST --data "{"temperature":42,"humidity":73}" http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" ``` {: .copy-code} + {% endif %} {% if docsPrefix contains "paas/" %} + ```shell curl -v -X POST --data "{"temperature":42,"humidity":73}" {{httpsUrl}}/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -```shell -curl -v -X POST --data "{"temperature":42,"humidity":73}" http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" -``` -{: .copy-code} + {% endif %} Telemetry data: @@ -121,28 +131,28 @@ Telemetry data: {"temperature":42,"humidity":73} ``` -**Example 2**. Publish data as an object without timestamp (server-side timestamp will be used) using data from [**telemetry-data-as-object.json**](/docs/reference/resources/telemetry-data-as-object.json) file. +**Example 2**. +Publish data as an object without timestamp (server-side timestamp will be used) using data from [telemetry-data-as-object.json](/docs/reference/resources/telemetry-data-as-object.json){:target="_blank" download="telemetry-data-as-object.json"} file. Execute the command: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} + ```shell -curl -v -X POST -d @telemetry-data-as-object.json http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" +curl -v -X POST -d @telemetry-data-as-object.json http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" ``` {: .copy-code} + {% endif %} {% if docsPrefix contains "paas/" %} + ```shell curl -v -X POST -d @telemetry-data-as-object.json {{httpsUrl}}/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" ``` {: .copy-code} + {% endif %} -{% if docsPrefix == "edge/" %} -```shell -curl -v -X POST -d @telemetry-data-as-object.json http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" -``` -{: .copy-code} -{% endif %} + The content of the JSON file: @@ -160,27 +170,25 @@ The content of the JSON file: } ``` -**Example 3**. Publish data as an array of objects without timestamp (server-side timestamp will be used) using data from [**telemetry-data-as-array.json**](/docs/reference/resources/telemetry-data-as-array.json) file. +**Example 3**. +Publish data as an array of objects without timestamp (server-side timestamp will be used) using data from [telemetry-data-as-array.json](/docs/reference/resources/telemetry-data-as-array.json){:target="_blank" download="telemetry-data-as-array.json"} file. Execute the command: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -curl -v -X POST -d @telemetry-data-as-array.json http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" +curl -v -X POST -d @telemetry-data-as-array.json http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" ``` {: .copy-code} + {% endif %} {% if docsPrefix contains "paas/" %} + ```shell curl -v -X POST -d @telemetry-data-as-array.json {{httpsUrl}}/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -```shell -curl -v -X POST -d @telemetry-data-as-array.json http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" -``` -{: .copy-code} + {% endif %} The content of the JSON file: @@ -189,27 +197,24 @@ The content of the JSON file: [{"key1":"value1"}, {"key2":true}] ``` -**Example 4**. Publish data as an object with timestamp (telemetry timestamp will be used) using data from [**telemetry-data-with-ts.json**](/docs/reference/resources/telemetry-data-with-ts.json) file. +**Example 4**. Publish data as an object with timestamp (telemetry timestamp will be used) using data from [telemetry-data-with-ts.json](/docs/reference/resources/telemetry-data-with-ts.json){:target="_blank" download="telemetry-data-with-ts.json"} file. Execute the command: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -curl -v -X POST -d @telemetry-data-with-ts.json http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" +curl -v -X POST -d @telemetry-data-with-ts.json http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" ``` {: .copy-code} + {% endif %} {% if docsPrefix contains "paas/" %} + ```shell curl -v -X POST -d @telemetry-data-with-ts.json {{httpsUrl}}/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -```shell -curl -v -X POST -d @telemetry-data-with-ts.json http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry --header "Content-Type:application/json" -``` -{: .copy-code} + {% endif %} The content of the JSON file: @@ -233,27 +238,28 @@ The content of the JSON file: } ``` +
+ ## Attributes API ThingsBoard attributes API allows devices to -* Upload [client-side](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types) device attributes to the server. -* Request [client-side](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types) and [shared](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types) device attributes from the server. -* Subscribe to [shared](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types) device attributes from the server. - +* Upload [client-side](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types){:target="_blank"} device attributes to the server. +* Request [client-side](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types){:target="_blank"} and [shared](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types){:target="_blank"} device attributes from the server. +* Subscribe to [shared](/docs/{{docsPrefix}}user-guide/attributes/#attribute-types){:target="_blank"} device attributes from the server. + +
+ ### Publish attribute update to the server In order to publish client-side device attributes to ThingsBoard server node, send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes +http(s)://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is running on; -- **$ACCESS_TOKEN** - device access token. {% endif %} {% if docsPrefix contains "paas/" %} @@ -262,27 +268,21 @@ Where ``` {: .copy-code} -Where **$ACCESS_TOKEN** - device access token. - {% endif %} -Below are the examples of commands for publishing different types of telemetry data. +> Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is the device's access token. +
-{% if docsPrefix == null or docsPrefix == "pe/" %} -Don't forget to replace $THINGSBOARD_HOST_NAME with your host and port and $ACCESS_TOKEN with your device's access token. -{% endif %} -{% if docsPrefix contains "paas/" %} -Don't forget to replace $ACCESS_TOKEN with your device's access token. -{% endif %} -{% if docsPrefix == "edge/" %} -Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host and port and $ACCESS_TOKEN with your device's access token. -{% endif %} +Below are the examples of commands for publishing different types of telemetry data. -**Example 1**. Publish client-side attributes update +**Example 1**. +Publish client-side attributes update -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -curl -v -X POST --data "{"attribute1": "value1", "attribute2":true, "attribute3": 43.0}" http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes --header "Content-Type:application/json" +curl -v -X POST --data "{"attribute1": "value1", "attribute2":true, "attribute3": 43.0}" http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes --header "Content-Type:application/json" ``` {: .copy-code} {% endif %} @@ -292,33 +292,25 @@ curl -v -X POST --data "{"attribute1": "value1", "attribute2":true, "attribute3" ``` {: .copy-code} {% endif %} -{% if docsPrefix == "edge/" %} -```shell -curl -v -X POST --data "{"attribute1": "value1", "attribute2":true, "attribute3": 43.0}" http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes --header "Content-Type:application/json" -``` -{: .copy-code} -{% endif %} +**Example 2**. +Publish client-side attributes update from the [new-attributes-values.json](/docs/reference/resources/new-attributes-values.json){:target="_blank" download="new-attributes-values.json"} file. -**Example 2**. Publish client-side attributes update from the [**new-attributes-values.json**](/docs/reference/resources/new-attributes-values.json) file. +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} -{% if docsPrefix == null or docsPrefix == "pe/" %} ```shell -curl -v -X POST -d @new-attributes-values.json http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes --header "Content-Type:application/json" +curl -v -X POST -d @new-attributes-values.json http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes --header "Content-Type:application/json" ``` {: .copy-code} + {% endif %} {% if docsPrefix contains "paas/" %} + ```shell curl -v -X POST -d @new-attributes-values.json {{httpsUrl}}/api/v1/$ACCESS_TOKEN/attributes --header "Content-Type:application/json" ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -```shell -curl -v -X POST -d @new-attributes-values.json http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes --header "Content-Type:application/json" -``` -{: .copy-code} + {% endif %} The content of the JSON file: @@ -338,19 +330,18 @@ The content of the JSON file: ``` {: .copy-code} +
+ ### Request attribute values from the server In order to request client-side or shared device attributes to ThingsBoard server node, send GET request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 +http(s)://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is running on; -- **$ACCESS_TOKEN** - device access token. {% endif %} {% if docsPrefix contains "paas/" %} @@ -359,36 +350,28 @@ Where ``` {: .copy-code} -Where **$ACCESS_TOKEN** - device access token. {% endif %} -{% if docsPrefix == null or docsPrefix == "pe/" %} -Execute the command. Don't forget to replace $THINGSBOARD_HOST_NAME with your host and port and $ACCESS_TOKEN with your device's access token. -{% endif %} -{% if docsPrefix contains "paas/" %} -Execute the command. Don't forget to replace $ACCESS_TOKEN with your device's access token. -{% endif %} -{% if docsPrefix == "edge/" %} -Execute the command. Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host and port and $ACCESS_TOKEN with your device's access token. -{% endif %} +> Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is the device's access token. -{% if docsPrefix == "pe/" %} +
+ +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -curl -v -X GET http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 +curl -v -X GET http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 ``` {: .copy-code} + {% endif %} {% if docsPrefix contains "paas/" %} + ```shell curl -v -X GET "{{httpsUrl}}/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2" ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -```shell -curl -v -X GET "http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2" -``` -{: .copy-code} + {% endif %} Result: @@ -404,19 +387,19 @@ However, it is still possible to have same keys for client, shared or even serve {% endcapture %} {% include templates/info-banner.md content=difference %} +
+ ### Subscribe to attribute updates from the server In order to subscribe to shared device attribute changes, send GET request with optional "timeout" request parameter to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} + ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes/updates +http(s)://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes/updates ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is running on; -- **$ACCESS_TOKEN** - device access token. {% endif %} {% if docsPrefix contains "paas/" %} @@ -425,39 +408,28 @@ Where ``` {: .copy-code} -Where **$ACCESS_TOKEN** - device access token. - {% endif %} -Once shared attribute will be changed by one of the server-side components (REST API or Rule Chain) the client will receive the following update: +> Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is the device's access token. -{% if docsPrefix == null or docsPrefix == "pe/" %} -Execute the command. Don't forget to replace $THINGSBOARD_HOST_NAME with your host and port and $ACCESS_TOKEN with your device's access token. -{% endif %} -{% if docsPrefix contains "paas/" %} -Execute the command. Don't forget to replace $ACCESS_TOKEN with your device's access token. -{% endif %} -{% if docsPrefix == "edge/" %} -Execute the command. Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host and port and $ACCESS_TOKEN with your device's access token. -{% endif %} +Once shared attribute will be changed by one of the server-side components (REST API or Rule Chain) the client will receive the following update: -{% if docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -curl -v -X GET http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes/updates?timeout=20000 +curl -v -X GET http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes/updates?timeout=20000 ``` {: .copy-code} + {% endif %} {% if docsPrefix contains "paas/" %} + ```shell curl -v -X GET {{httpsUrl}}/api/v1/$ACCESS_TOKEN/attributes/updates?timeout=20000 ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -```shell -curl -v -X GET http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes/updates?timeout=20000 -``` -{: .copy-code} + {% endif %} Result: @@ -465,25 +437,26 @@ Result: {"client":{"attribute1":"value1","attribute2":true}} ``` +
+ ## JSON value support {% include templates/api/json.md %} +
+ ## RPC API ### Server-side RPC In order to subscribe to RPC commands from the server, send GET request with optional "timeout" request parameter to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc +http(s)://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is running on; -- **$ACCESS_TOKEN** - device access token. {% endif %} {% if docsPrefix contains "paas/" %} @@ -492,10 +465,12 @@ Where ``` {: .copy-code} -Where **$ACCESS_TOKEN** - device access token. - {% endif %} +> Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is the device's access token. + Once subscribed, a client may receive rpc request or a timeout message if there are no requests to a particular device. An example of RPC request body is shown below: @@ -510,17 +485,16 @@ An example of RPC request body is shown below: } ``` -where - - - **id** - request id, integer request identifier - - **method** - RPC method name, string - - **params** - RPC method params, custom json object +> Where + • **id** - request id, integer request identifier + • **method** - RPC method name, string + • **params** - RPC method params, custom json object It is possible to reply to them using POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc/{$id} +http(s)://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc/{$id} ``` {: .copy-code} @@ -534,48 +508,42 @@ http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc/{$id} {% endif %} -Where -- **$id** is an integer request identifier. +> Where $id is an integer request identifier.
-**Let's look at an example**: +**Let's look at an example**: - Use **RPC debug terminal** widget in your ThingsBoard instance; +- Subscribe to RPC commands from the server using the command below. To do this, in the first terminal window send GET request with observe flag. -{% if docsPrefix == null or docsPrefix == "pe/" %} -- Subscribe to RPC commands from the server using the command below. To do this, in the first terminal window send GET request with observe flag. Don't forget to replace $THINGSBOARD_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token: +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -curl -v -X GET http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc?timeout=20000 +curl -v -X GET http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc?timeout=20000 ``` {: .copy-code} + {% endif %} {% if docsPrefix contains "paas/" %} -- Subscribe to RPC commands from the server using the command below. Don't forget to replace $ACCESS_TOKEN with your device's access token: ```shell curl -v -X GET {{httpsUrl}}/api/v1/$ACCESS_TOKEN/rpc?timeout=20000 ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -- Subscribe to RPC commands from the server using the command below. Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token: -```shell -curl -v -X GET http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc?timeout=20000 -``` -{: .copy-code} {% endif %} -- Send an RPC request "connect" to the device using **RPC debug terminal** widget; - -- Save the "[rpc-response.json](/docs/reference/resources/rpc-response.json)" file to your PC; +> Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is the device's access token. +- Send an RPC request "connect" to the device using **RPC debug terminal** widget; +- Save the [rpc-response.json](/docs/reference/resources/rpc-response.json){:target="_blank" download="rpc-response.json"} file to your PC; - In the second terminal window simulate sending a response from the device to the server: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -curl -v -X POST -d @rpc-response.json http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc/1 --header "Content-Type:application/json" +curl -v -X POST -d @rpc-response.json http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc/1 --header "Content-Type:application/json" ``` {: .copy-code} {% endif %} @@ -585,34 +553,29 @@ curl -v -X POST -d @rpc-response.json {{httpsUrl}}/api/v1/$ACCESS_TOKEN/rpc/1 -- ``` {: .copy-code} {% endif %} -{% if docsPrefix == "edge/" %} -```shell -curl -v -X POST -d @rpc-response.json http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc/1 --header "Content-Type:application/json" -``` -{: .copy-code} -{% endif %} -- You should receive a response from the device: +You should receive a response from the device: ```shell {"result":"ok"} ``` +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "paas/" or docsPrefix == "paas/eu/" %} {% include images-gallery.html imageCollection="server-side-rpc" %} +{% endif %} + +
### Client-side RPC In order to send RPC commands to the server, send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc +http(s)://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is running on; -- **$ACCESS_TOKEN** - device access token. {% endif %} {% if docsPrefix contains "paas/" %} @@ -621,74 +584,72 @@ Where ``` {: .copy-code} -Where **$ACCESS_TOKEN** - device access token. - {% endif %} +> Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is the device's access token. + Both request and response body should be valid JSON documents. The content of the documents is specific to the rule node that will handle your request.
-**Let's look at an example**: - -- Add two nodes to the Rule Chain: "**script**" and "**rpc call reply**"; +**Example** +- In the {% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}**Edge** {% endif %}**Root Rule Chain** add two nodes: [transformation script](/docs/user-guide/rule-engine-2-0/nodes/transformation/script){:target="_blank"} and [rpc call reply](/docs/user-guide/rule-engine-2-0/nodes/action/rpc-call-reply){:target="_blank"}. Connect them to "[Log RPC from Device](/docs/user-guide/rule-engine-2-0/nodes/action/log){:target="_blank"}" action node with "**Success**" link. - In the **script** node enter the function: ```shell -return {msg: {time:String(new Date())}, metadata: metadata, msgType: msgType}; +return {msg: {time: new Date()}, metadata: metadata, msgType: msgType}; ``` {: .copy-code} -- Save the "[rpc-client-request.json](/docs/reference/resources/rpc-client-request.json)" file to your PC; +- Save the [rpc-client-request.json](/docs/reference/resources/rpc-client-request.json){:target="_blank" download="rpc-client-request.json"} file to your PC; +- Now, send request to the server using the command below: -{% if docsPrefix == null or docsPrefix == "pe/" %} -- Now, send request to the server using the command below. Don't forget to replace $THINGSBOARD_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token: +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -curl -X POST -d @rpc-client-request.json http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc --header "Content-Type:application/json" +curl -X POST -d @rpc-client-request.json http://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc --header "Content-Type:application/json" ``` {: .copy-code} + {% endif %} {% if docsPrefix contains "paas/" %} -- Now, send request to the server using the command below. Don't forget to replace $ACCESS_TOKEN with your device's access token: ```shell curl -X POST -d @rpc-client-request.json {{httpsUrl}}/api/v1/$ACCESS_TOKEN/rpc --header "Content-Type:application/json" ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -- Now, send request to the server using the command below. Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token: -```shell -curl -X POST -d @rpc-client-request.json http://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc --header "Content-Type:application/json" -``` -{: .copy-code} {% endif %} -- You should receive a response from the server: +You should receive a response from the server: ```shell -{"time":"2016 11 21 12:54:44.287"} +{"time":"Thursday, February 5, 2026, 9:08:22 AM Coordinated Universal Time"} ``` +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "paas/" or docsPrefix == "paas/eu/" %} {% include images-gallery.html imageCollection="client-side-rpc" %} +{% endif %} + +
## Claiming devices -Please see the corresponding article to get more information about the [Claiming devices](/docs/{{docsPrefix}}user-guide/claiming-devices) feature. +The Device Claiming feature allows end users to securely associate a device with their account after the device has been deployed and connected to ThingsBoard. +For a detailed explanation of the device claiming workflow and supported scenarios, refer to the {% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix contains "paas/" %}[Claiming devices](/docs/{{docsPrefix}}user-guide/claiming-devices){:target="_blank"}{% endif %}{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}[Claiming devices](/docs/user-guide/claiming-devices){:target="_blank"}{% endif %} documentation. -In order to initiate claiming device, send POST request to the following URL: +**Claiming request** +To initiate the device claiming process, the device must send a POST request to the following endpoint: + +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} -{% if docsPrefix == null or docsPrefix == "pe/" %} ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/claim +http(s)://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/claim ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is running on; -- **$ACCESS_TOKEN** - device access token. {% endif %} {% if docsPrefix contains "paas/" %} @@ -697,37 +658,47 @@ Where ``` {: .copy-code} -Where **$ACCESS_TOKEN** - device access token. - {% endif %} -The supported data format is: +> Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is the device's access token. + +**Request payload** +The request body must contain the following JSON structure: ```json {"secretKey":"value", "durationMs":60000} ``` +**Payload fields** +- **secretKey** — a secret value used to authorize the claiming process +- **durationMs** — the time window (in milliseconds) during which the device can be claimed + {% capture difference %} -**Please note** -
-that the above fields are optional. In case the **secretKey** is not specified, the empty string as a default value is used. +**Please note** that the above fields are optional. In case the **secretKey** is not specified, the empty string as a default value is used. In case the **durationMs** is not specified, the system parameter **device.claim.duration** is used (in the file **/etc/thingsboard/conf/thingsboard.yml**). {% endcapture %} {% include templates/info-banner.md content=difference %} +
+ ## Device provisioning -Please see the corresponding article to get more information about the [Device provisioning](/docs/{{docsPrefix}}user-guide/device-provisioning) feature. +Device provisioning allows devices to be registered dynamically without manual creation in the ThingsBoard UI. +For a detailed explanation of the provisioning process and supported scenarios, refer to the {% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix contains "paas/" %}[Device provisioning](/docs/{{docsPrefix}}user-guide/device-provisioning){:target="_blank"}{% endif %}{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}[Device provisioning](/docs/user-guide/device-provisioning){:target="_blank"}{% endif %} documentation. -In order to initiate device provisioning, send POST request to the following URL: +**Provisioning request** +To initiate device provisioning, send a POST request to the following endpoint: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/provision +http(s)://{{HOST_NAME}}/api/v1/provision ``` {: .copy-code} -Where **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is running on; +Where **{{HOST_NAME}}** is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + {% endif %} {% if docsPrefix contains "paas/" %} @@ -735,9 +706,11 @@ Where **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is r {{httpsUrl}}/api/v1/provision ``` {: .copy-code} + {% endif %} -The supported data format is: +**Request Payload** +The provisioning request must use the following JSON format: ```json { @@ -747,22 +720,28 @@ The supported data format is: } ``` +**Payload fields** +- **deviceName** — the name of the device to be provisioned. +- **provisionDeviceKey** — the provisioning key configured in ThingsBoard. +- **provisionDeviceSecret** — the provisioning secret associated with the provisioning key. + +If the provided credentials are valid, ThingsBoard automatically creates the device (if it does not already exist) and returns the device credentials, allowing the device to start communicating with the platform. + +
+ ## Firmware API -When ThingsBoard initiates the firmware update over HTTP it sets the fw_title, fw_version, fw_checksum, fw_checksum_algorithm shared attributes. -To receive the shared attribute updates, the device has to GET request +When ThingsBoard initiates the firmware update over HTTP it sets the _fw_title_, _fw_version_, _fw_checksum_, _fw_checksum_algorithm_ shared attributes. + +To receive firmware update information and download the firmware, the device must send a GET request to the following endpoint: + +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} -{% if docsPrefix == null or docsPrefix == "pe/" %} ```shell -http(s)://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/firmware?title=$TITLE&version=$VERSION +http(s)://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/firmware?title=$TITLE&version=$VERSION ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** - the hostname or IP address your platform is running on; -- **$ACCESS_TOKEN** - the device access token; -- **$TITLE** - the firmware title; -- **$VERSION** - the version of the target firmware. {% endif %} {% if docsPrefix contains "paas/" %} @@ -771,16 +750,21 @@ Where ``` {: .copy-code} -Where -- **$ACCESS_TOKEN** - the device access token; -- **$TITLE** - the firmware title; -- **$VERSION** - the version of the target firmware. - {% endif %} +Parameters +{% unless docsPrefix contains "paas/" %} • **{{HOST_NAME}}** is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address{% endunless %} + • **$ACCESS_TOKEN** is your device's access token + • **$TITLE** - the firmware title + • **$VERSION** - the target firmware version + +
+ ## Protocol customization -HTTP transport can be fully customized for specific use-case by changing the corresponding [module](https://github.com/thingsboard/thingsboard/tree/master/transport/http). +HTTP transport can be fully customized for specific use-case by changing the corresponding [module](https://github.com/thingsboard/thingsboard/tree/master/transport/http){:target="_blank"}. + +
## Next steps diff --git a/_includes/docs/reference/mqtt-api.md b/_includes/docs/reference/mqtt-api.md index 0539d809c4..f53aec53a4 100644 --- a/_includes/docs/reference/mqtt-api.md +++ b/_includes/docs/reference/mqtt-api.md @@ -52,8 +52,7 @@ ThingsBoard supports multiple authentication mechanisms to secure MQTT connectio Topic names and payload formats for MQTT communication are configured via the **Device profile**. For more details, see [here](/docs/user-guide/device-profiles/#mqtt-transport-type){:target="_blank"}. -> **Note** - This guide uses **access token–based authentication**. +> The examples in this guide use **access token–based authentication**.
@@ -79,10 +78,10 @@ mosquitto_pub -d -q 1 -h "{{mqttHostName}}" -p "1883" -t "v1/devices/me/telemetr {: .copy-code} {% endif %} -{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} > ⚠️ **Don't forget to replace:** ->  • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge" %} Edge{% endif %} hostname or IP address. +>  • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. >  • $ACCESS_TOKEN with your device's access token. ```bash @@ -91,7 +90,7 @@ mosquitto_pub -d -q 1 -h "{{HOST_NAME}}" -p "1883" -t "v1/devices/me/telemetry" {: .copy-code} **Example** -In this example, {{HOST_NAME}} refers to your local ThingsBoard {% if docsPrefix == "edge/" or docsPrefix == "pe/edge" %}Edge {% endif %}installation, and $ACCESS_TOKEN is set to ABC123. +In this example, {{HOST_NAME}} refers to your local ThingsBoard {% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}Edge {% endif %}installation, and $ACCESS_TOKEN is set to ABC123. ```bash mosquitto_pub -d -q 1 -h "localhost" -p "1883" -t "v1/devices/me/telemetry" -u "ABC123" -m {"temperature":25} @@ -279,7 +278,7 @@ v1/devices/me/attributes ``` {: .copy-code} -
Examples +Examples Below are the examples of how to publish client-side device attributes. > ⚠️ Don't forget to replace {% unless docsPrefix contains "paas/" %} @@ -298,9 +297,9 @@ Telemetry data: Execute the command: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -mosquitto_pub -d -h "$THINGSBOARD_HOST_NAME" -t "v1/devices/me/attributes" -u "$ACCESS_TOKEN" -m "{"attribute1": "value1", "attribute2": true}" +mosquitto_pub -d -h "{{HOST_NAME}}" -t "v1/devices/me/attributes" -u "$ACCESS_TOKEN" -m "{"attribute1": "value1", "attribute2": true}" ``` {: .copy-code} {% else %} @@ -358,23 +357,14 @@ v1/devices/me/attributes/response/+ The following example is written in javascript and is based on mqtt.js. Pure command-line examples are not available because subscribe and publish need to happen in the same mqtt session. -{% if docsPrefix == nil or docsPrefix == "pe/" %} -**1.** Save the [mqtt-js-attributes-request.js](/docs/pe/reference/resources/mqtt-js-attributes-request.js){:target="_blank" download="mqtt-js-attributes-request.js"} file to your PC. +**1.** Save the [mqtt-js-attributes-request.js](/docs/{{docsPrefix}}reference/resources/mqtt-js-attributes-request.js){:target="_blank" download="mqtt-js-attributes-request.js"} file to your PC. -> ⚠️ In this example, the hostname refers to a **local ThingsBoard installation**. -> If your ThingsBoard instance is deployed on a different host, make sure to replace localhost with the appropriate hostname or IP address. +{% unless docsPrefix contains 'paas/' %} -{% endif %} -{% if docsPrefix contains 'paas/' %} -**1.** Save the [mqtt-js-attributes-request.js](/docs/paas/reference/resources/mqtt-js-attributes-request.js){:target="_blank" download="mqtt-js-attributes-request.js"} file to your PC. -{% endif %} -{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} -**1.** Save the [mqtt-js-attributes-request.js](/docs/edge/reference/resources/mqtt-js-attributes-request.js){:target="_blank" download="mqtt-js-attributes-request.js"} file to your PC. - -> ⚠️ In this example, the hostname refers to a **local ThingsBoard Edge installation**. -> If your ThingsBoard Edge instance is deployed on a different host, make sure to replace localhost with the appropriate hostname or IP address. +> ⚠️ In this example, the hostname refers to a **local ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} installation**. +> If your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} instance is deployed on a different host, make sure to replace localhost with the appropriate hostname or IP address. -{% endif %} +{% endunless %} {% capture tabspec %}mqtt-attributes-request A,The content of the "mqtt-js-attributes-request.js" file:,javascript,resources/mqtt-js-attributes-request.js,/docs/reference/resources/mqtt-js-attributes-request.js{% endcapture %} @@ -518,11 +508,12 @@ Your MQTT gateway device will receive a service RPC about removal or renaming of In order to send RPC commands to server, send PUBLISH message to the following topic: ```shell -v1/devices/me/rpc/request/$request_id +v1/devices/me/rpc/request/$REQUEST_ID ``` {: .copy-code} -where **$request_id** is an integer request identifier. +> Where $REQUEST_ID is an integer request identifier. + The response from server will be published to the following topic: ```shell @@ -556,11 +547,11 @@ A,The content of the "mqtt-js-rpc-from-client.js" file,javascript,resources/mqtt {% include tabs.html %} **2.** Now, follow these steps: -- In the {% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}**Edge** {% endif %}**Root Rule Chain** add two nodes: [script](/docs/user-guide/rule-engine-2-0/nodes/transformation/script){:target="_blank"} and [rpc call reply](/docs/user-guide/rule-engine-2-0/nodes/action/rpc-call-reply){:target="_blank"}. +- In the {% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}**Edge** {% endif %}**Root Rule Chain** add two nodes: [transformation script](/docs/user-guide/rule-engine-2-0/nodes/transformation/script){:target="_blank"} and [rpc call reply](/docs/user-guide/rule-engine-2-0/nodes/action/rpc-call-reply){:target="_blank"}. Connect them to "[Log RPC from Device](/docs/user-guide/rule-engine-2-0/nodes/action/log){:target="_blank"}" action node with "**Success**" link. - In the **script** node enter the function: ```shell -return {msg: {time:String(new Date())}, metadata: metadata, msgType: msgType}; +return {msg: {time: new Date()}, metadata: metadata, msgType: msgType}; ``` {: .copy-code} @@ -574,7 +565,11 @@ node mqtt-js-rpc-from-client.js ``` {: .copy-code} -- You should receive a response from the server. +You should receive a response from the server: + +```shell +{"time":"Thursday, February 5, 2026, 9:08:22 AM Coordinated Universal Time"} +``` {% unless docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} {% include images-gallery.html imageCollection="client-side-rpc" %} @@ -666,7 +661,8 @@ These limits help control load and ensure stable operation when multiple devices ## Claiming devices -Please see the corresponding article to get more information about the [Claiming devices](/docs/{{docsPrefix}}user-guide/claiming-devices){:target="_blank"} feature. +The Device Claiming feature allows end users to securely associate a device with their account after the device has been deployed and connected to ThingsBoard. +For a detailed explanation of the device claiming workflow and supported scenarios, refer to the {% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix contains "paas/" %}[Claiming devices](/docs/{{docsPrefix}}user-guide/claiming-devices){:target="_blank"}{% endif %}{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}[Claiming devices](/docs/user-guide/claiming-devices){:target="_blank"}{% endif %} documentation. In order to initiate claiming device, send PUBLISH message to the following topic: @@ -691,9 +687,11 @@ In case the **durationMs** is not specified, the system parameter **device.claim ## Device provisioning -Please see the corresponding article to get more information about the [Device provisioning](/docs/{{docsPrefix}}user-guide/device-provisioning){:target="_blank"} feature. +Device provisioning allows devices to be registered dynamically without manual creation in the ThingsBoard UI. +For a detailed explanation of the provisioning process and supported scenarios, refer to the {% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix contains "paas/" %}[Device provisioning](/docs/{{docsPrefix}}user-guide/device-provisioning){:target="_blank"}{% endif %}{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}[Device provisioning](/docs/user-guide/device-provisioning){:target="_blank"}{% endif %} documentation. -In order to initiate device provisioning, send Provisioning request to the following topic: +**Provisioning request** +To initiate device provisioning, send Provisioning request to the following topic: ```shell /provision @@ -702,7 +700,8 @@ In order to initiate device provisioning, send Provisioning request to the follo Also, you should set **username** or **clientId** to *provision*. -The supported data format is: +**Request Payload** +The provisioning request must use the following JSON format: ```json { @@ -712,6 +711,13 @@ The supported data format is: } ``` +**Payload fields** +- **deviceName** — the name of the device to be provisioned. +- **provisionDeviceKey** — the provisioning key configured in ThingsBoard. +- **provisionDeviceSecret** — the provisioning secret associated with the provisioning key. + +If the provided credentials are valid, ThingsBoard automatically creates the device (if it does not already exist) and returns the device credentials, allowing the device to start communicating with the platform. +
## Firmware API diff --git a/_includes/docs/user-guide/ssl/http-access-token.md b/_includes/docs/user-guide/ssl/http-access-token.md index 7ac17d258f..480aba7578 100644 --- a/_includes/docs/user-guide/ssl/http-access-token.md +++ b/_includes/docs/user-guide/ssl/http-access-token.md @@ -1,6 +1,9 @@ * TOC {:toc} -Access Token Based Authentication is the default device authentication type. Once the device is created in ThingsBoard, the default access token is generated. It can be changed afterwards. -In order to connect the device to a server using Access Token based authentication, the client must specify the access token as part of HTTP request URL. -See [HTTP API](/docs/{{docsPrefix}}reference/coap-api/) for more details. There are no specific examples, since all modern HTTP clients support HTTPS as well. \ No newline at end of file +Access token–based authentication is the default authentication method for devices in ThingsBoard. +When a device is created, ThingsBoard automatically generates a unique access token. This token can be [updated](/docs/{{docsPrefix}}user-guide/ui/devices/#manage-device-credentials){:target="_blank"} later in the device details. + +To authenticate a device over HTTP, the client must include the access token as part of the HTTP request URL. + +For details about supported endpoints, request formats, and payloads, refer to the [HTTP API](/docs/{{docsPrefix}}reference/http-api/){:target="_blank"} documentation. \ No newline at end of file diff --git a/_includes/docs/user-guide/ui/devices.md b/_includes/docs/user-guide/ui/devices.md index 3859489b7c..9df895cd8d 100644 --- a/_includes/docs/user-guide/ui/devices.md +++ b/_includes/docs/user-guide/ui/devices.md @@ -140,15 +140,25 @@ Second way: ## Check connectivity -To verify if your device is successfully connected to ThingsBoard: -- Open the "**Device details**" window and click "**Check connectivity**". -- Select: - - [Communication protocol](/docs/{{docsPrefix}}reference/protocols/){:target="_blank"} ([MQTT](/docs/{{docsPrefix}}reference/mqtt-api){:target="_blank"}, [HTTP](/docs/{{docsPrefix}}reference/http-api){:target="_blank"}, etc.) - - Operating system -- If required, install the necessary client tools. -- Copy the generated command and run it in a **Terminal**. - -If successful, the device status will change from "**Inactive**" to "**Active**", and telemetry data (e.g., temperature) will appear. +**Check connectivity** is a built-in feature that provides ready-to-use commands for testing device connectivity to ThingsBoard using different communication protocols. It allows you to quickly verify network access, validate credentials, and confirm that incoming telemetry is processed correctly. + +Using this feature, you can publish test telemetry data (for example, a temperature value of 25) and immediately ensure that the device is able to communicate with the platform. + +**To verify device connectivity:** +1. Click on device to open its details page. +2. Click **Check connectivity**. +3. Select the [communication protocol](/docs/{{docsPrefix}}reference/protocols/){:target="_blank"} ([MQTT](/docs/{{docsPrefix}}reference/mqtt-api){:target="_blank"}, [HTTP](/docs/{{docsPrefix}}reference/http-api){:target="_blank"}, etc.) and your operating system. +4. Copy the generated command and execute it in a terminal. + +If the connection is successful: +- The device status changes from **Inactive** to **Active**. +- Telemetry data appears on the **Latest telemetry** tab. + +{% capture difference %} +For guidance on connecting devices based on your technology stack, see the available [connection guides](/docs/guides/#AnchorIDGettingStartedGuides){:target="_blank"}.
+For advanced protocols and API options, refer to the [ThingsBoard API reference](/docs/{{docsPrefix}}reference/protocols/){:target="_blank"}. +{% endcapture %} +{% include templates/info-banner.md content=difference %} {% include images-gallery.html imageCollection="check-connectivity" %} diff --git a/_includes/templates/api/coap/claiming-devices-access-token.md b/_includes/templates/api/coap/claiming-devices-access-token.md index c6d0667c6e..56d2f18e52 100644 --- a/_includes/templates/api/coap/claiming-devices-access-token.md +++ b/_includes/templates/api/coap/claiming-devices-access-token.md @@ -1,22 +1,22 @@ Send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} + ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/claim +coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/claim ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address; -- **$ACCESS_TOKEN** is device access token. - {% endif %} {% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} + ```shell coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/claim ``` {: .copy-code} -Where **$ACCESS_TOKEN** is device access token. +{% endif %} -{% endif %} \ No newline at end of file +> ⚠️ Don't forget to replace {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN with your device's access token. \ No newline at end of file diff --git a/_includes/templates/api/coap/claiming-devices-certificate.md b/_includes/templates/api/coap/claiming-devices-certificate.md index 317aa2714f..afdf303d5f 100644 --- a/_includes/templates/api/coap/claiming-devices-certificate.md +++ b/_includes/templates/api/coap/claiming-devices-certificate.md @@ -1,15 +1,17 @@ Send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} + ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/claim +coap://{{HOST_NAME}}/api/v1/claim ``` {: .copy-code} -Where **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address. +> ⚠️ Don't forget to replace {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. {% endif %} {% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} + ```shell coap://{{coapHostName}}/api/v1/claim ``` diff --git a/_includes/templates/api/coap/client-side-rpc-access-token.md b/_includes/templates/api/coap/client-side-rpc-access-token.md index 8bb7e6e6f4..0931f8d500 100644 --- a/_includes/templates/api/coap/client-side-rpc-access-token.md +++ b/_includes/templates/api/coap/client-side-rpc-access-token.md @@ -1,71 +1,67 @@ Send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc +coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address; -- **$ACCESS_TOKEN** is device access token. - {% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} +{% if docsPrefix contains "paas/" %} + ```shell coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/rpc ``` {: .copy-code} -Where **$ACCESS_TOKEN** is device access token. - {% endif %} +> Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is your device's access token. + Both request and response body should be valid JSON documents. The content of the documents is specific to the rule node that will handle your request.
-**Let's look at an example**: - -- Add two nodes to the Rule Chain: "**script**" and "**rpc call reply**"; +**Example** +- In the {% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}**Edge** {% endif %}**Root Rule Chain** add two nodes: [transformation script](/docs/user-guide/rule-engine-2-0/nodes/transformation/script){:target="_blank"} and [rpc call reply](/docs/user-guide/rule-engine-2-0/nodes/action/rpc-call-reply){:target="_blank"}. Connect them to "[Log RPC from Device](/docs/user-guide/rule-engine-2-0/nodes/action/log){:target="_blank"}" action node with "**Success**" link. - In the **script** node enter the function: ```shell -return {msg: {time:String(new Date())}, metadata: metadata, msgType: msgType}; +return {msg: {time: new Date()}, metadata: metadata, msgType: msgType}; ``` {: .copy-code} -- Save the "[rpc-client-request.json](/docs/reference/resources/rpc-client-request.json)" file to your PC; +- Save the [rpc-client-request.json](/docs/reference/resources/rpc-client-request.json){:target="_blank" download="rpc-client-request.json"} file to your PC; +- Now, send request to the server using the command below: -{% if docsPrefix == null or docsPrefix == "pe/" %} -- Now, send request to the server using the command below. Don't forget to replace $THINGSBOARD_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token: +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -cat rpc-client-request.json | coap post coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc +cat rpc-client-request.json | coap post coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc ``` {: .copy-code} + {% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} -- Now, send request to the server using the command below. Don't forget to replace $ACCESS_TOKEN with your device's access token: +{% if docsPrefix contains "paas/" %} ```shell cat rpc-client-request.json | coap post coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/rpc ``` {: .copy-code} {% endif %} -{% if docsPrefix == "edge/" %} -- Now, send request to the server using the command below. Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token: -```shell -cat rpc-client-request.json | coap post coap://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc -``` -{: .copy-code} -{% endif %} +> ⚠️ Replace {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN with your device's access token. - You should receive a response from the server: ```shell -{"time":"2016 11 21 12:54:44.287"} +{"time":"Thursday, February 5, 2026, 9:08:22 AM Coordinated Universal Time"} ``` -{% include images-gallery.html imageCollection="client-side-rpc" %} \ No newline at end of file +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "paas/" or docsPrefix == "paas/eu/" %} +{% include images-gallery.html imageCollection="client-side-rpc" %} +{% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/client-side-rpc-certificate.md b/_includes/templates/api/coap/client-side-rpc-certificate.md index 1a1a7c1c8d..97284bf46e 100644 --- a/_includes/templates/api/coap/client-side-rpc-certificate.md +++ b/_includes/templates/api/coap/client-side-rpc-certificate.md @@ -1,15 +1,17 @@ Send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} + ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/rpc +coap://{{HOST_NAME}}/api/v1/rpc ``` {: .copy-code} -Where **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address. +> ⚠️ Where {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. {% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} +{% if docsPrefix contains "paas/" %} + ```shell coap://{{coapHostName}}/api/v1/rpc ``` @@ -20,10 +22,9 @@ coap://{{coapHostName}}/api/v1/rpc Both request and response body should be valid JSON documents. The content of the documents is specific to the rule node that will handle your request.
-**Let's look at an example**: - -- Add two nodes to the Rule Chain: "**script**" and "**rpc call reply**"; +**Example** +- In the {% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %}**Edge** {% endif %}**Root Rule Chain** add two nodes: [transformation script](/docs/user-guide/rule-engine-2-0/nodes/transformation/script){:target="_blank"} and [rpc call reply](/docs/user-guide/rule-engine-2-0/nodes/action/rpc-call-reply){:target="_blank"}. Connect them to "[Log RPC from Device](/docs/user-guide/rule-engine-2-0/nodes/action/log){:target="_blank"}" action node with "**Success**" link. - In the **script** node enter the function: ```shell @@ -31,31 +32,26 @@ return {msg: {time:String(new Date())}, metadata: metadata, msgType: msgType}; ``` {: .copy-code} -- Save the "[rpc-client-request.json](/docs/reference/resources/rpc-client-request.json)" file to your PC; +- Save the [rpc-client-request.json](/docs/reference/resources/rpc-client-request.json){:target="_blank" download="rpc-client-request.json"} file to your PC; +- Now, send request to the server using the command below: -{% if docsPrefix == null or docsPrefix == "pe/" %} -- Now, send request to the server using the command below. Don't forget to replace $THINGSBOARD_HOST_NAME with your host: +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -cat rpc-client-request.json | coap post coap://$THINGSBOARD_HOST_NAME/api/v1/rpc +cat rpc-client-request.json | coap post coap://{{HOST_NAME}}/api/v1/rpc ``` {: .copy-code} + +> ⚠️ Replace {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + {% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} -- Now, send request to the server using the command below: +{% if docsPrefix contains "paas/" %} ```shell cat rpc-client-request.json | coap post coap://{{coapHostName}}/api/v1/rpc ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -- Now, send request to the server using the command below. Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host: -```shell -cat rpc-client-request.json | coap post coap://$THINGSBOARD_EDGE_HOST_NAME/api/v1/rpc -``` -{: .copy-code} {% endif %} - You should receive a response from the server: @@ -64,4 +60,6 @@ cat rpc-client-request.json | coap post coap://$THINGSBOARD_EDGE_HOST_NAME/api/v {"time":"2016 11 21 12:54:44.287"} ``` -{% include images-gallery.html imageCollection="client-side-rpc-certificate" %} \ No newline at end of file +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "paas/" or docsPrefix == "paas/eu/" %} +{% include images-gallery.html imageCollection="client-side-rpc-certificate" %} +{% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/firmware-api-access-token.md b/_includes/templates/api/coap/firmware-api-access-token.md index c01b474b9e..47904a6e45 100644 --- a/_includes/templates/api/coap/firmware-api-access-token.md +++ b/_includes/templates/api/coap/firmware-api-access-token.md @@ -1,16 +1,16 @@ The CoAP client has to issue the GET request to -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap get coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/firmware?title=$TITLE&version=$VERSION +coap get coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/firmware?title=$TITLE&version=$VERSION ``` {: .copy-code} Where -- **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address; -- **$ACCESS_TOKEN** is device access token; -- **$TITLE** is the firmware title; -- **$VERSION** is the version of the target firmware. +- **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address +- **$ACCESS_TOKEN** is device access token +- **$TITLE** is the firmware title +- **$VERSION** is the version of the target firmware {% endif %} {% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} @@ -20,8 +20,8 @@ coap get coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/firmware?title=$TITLE&vers {: .copy-code} Where -- **$ACCESS_TOKEN** is device access token; -- **$TITLE** is the firmware title; -- **$VERSION** is the version of the target firmware. +- **$ACCESS_TOKEN** is device access token +- **$TITLE** is the firmware title +- **$VERSION** is the version of the target firmware {% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/firmware-api-certificate.md b/_includes/templates/api/coap/firmware-api-certificate.md index 38d4e9d559..463c032e0e 100644 --- a/_includes/templates/api/coap/firmware-api-certificate.md +++ b/_includes/templates/api/coap/firmware-api-certificate.md @@ -1,8 +1,8 @@ The CoAP client has to issue the GET request to -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap get coap://$THINGSBOARD_HOST_NAME/api/v1/firmware?title=$TITLE&version=$VERSION +coap get coap://{{HOST_NAME}}/api/v1/firmware?title=$TITLE&version=$VERSION ``` {: .copy-code} diff --git a/_includes/templates/api/coap/publish-attribute-update-access-token.md b/_includes/templates/api/coap/publish-attribute-update-access-token.md index 352d72e567..728f95d8f3 100644 --- a/_includes/templates/api/coap/publish-attribute-update-access-token.md +++ b/_includes/templates/api/coap/publish-attribute-update-access-token.md @@ -1,23 +1,55 @@ Send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes +coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address; -- **$ACCESS_TOKEN** is device access token. +{% else %} + +```shell +coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/attributes +``` +{: .copy-code} {% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} +> ⚠️ Don't forget to replace {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN with your device's access token. + +Publish client-side attributes update using data from [new-attributes-values.json](/docs/reference/resources/new-attributes-values.json){:target="_blank" download="new-attributes-values.json"} file. + +The content of the **"new-attributes-values.json"** file: + +```json +{ + "attribute1": "value1", + "attribute2": true, + "attribute3": 42.0, + "attribute4": 73, + "attribute5": { + "someNumber": 42, + "someArray": [1,2,3], + "someNestedObject": {"key": "value"} + } +} +``` + +**Execute the command:** + +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/attributes +cat new-attributes-values.json | coap post coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes ``` {: .copy-code} -Where **$ACCESS_TOKEN** is device access token. +{% else %} + +```shell +cat new-attributes-values.json | coap post coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/attributes +``` +{: .copy-code} {% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/publish-attribute-update-certificate.md b/_includes/templates/api/coap/publish-attribute-update-certificate.md index e80bd657fc..8d54607560 100644 --- a/_includes/templates/api/coap/publish-attribute-update-certificate.md +++ b/_includes/templates/api/coap/publish-attribute-update-certificate.md @@ -1,19 +1,53 @@ Send POST request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/attributes +coap://{{HOST_NAME}}/api/v1/attributes ``` {: .copy-code} -Where **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address. +> ⚠️ Don't forget to replace {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. -{% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} +{% else %} ```shell coap://{{coapHostName}}/api/v1/attributes ``` {: .copy-code} +{% endif %} + +Publish client-side attributes update using data from [new-attributes-values.json](/docs/reference/resources/new-attributes-values.json){:target="_blank" download="new-attributes-values.json"} file. + +The content of the **"new-attributes-values.json"** file: + +```json +{ + "attribute1": "value1", + "attribute2": true, + "attribute3": 42.0, + "attribute4": 73, + "attribute5": { + "someNumber": 42, + "someArray": [1,2,3], + "someNestedObject": {"key": "value"} + } +} +``` + +**Execute the command:** + +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} +```shell +cat new-attributes-values.json | coap post coap://{{HOST_NAME}}/api/v1/attributes +``` +{: .copy-code} + +{% else %} + +```shell +cat new-attributes-values.json | coap post coap://{{coapHostName}}/api/v1/attributes +``` +{: .copy-code} + {% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/request-attribute-values-access-token.md b/_includes/templates/api/coap/request-attribute-values-access-token.md index c86849eb66..df00451280 100644 --- a/_includes/templates/api/coap/request-attribute-values-access-token.md +++ b/_includes/templates/api/coap/request-attribute-values-access-token.md @@ -1,22 +1,42 @@ Send GET request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 +coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address; -- **$ACCESS_TOKEN** is device access token. +{% else %} -{% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} ```shell coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 ``` {: .copy-code} -Where **$ACCESS_TOKEN** is device access token. +{% endif %} + +> ⚠️ Don't forget to replace {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN with your device's access token. + +{% capture difference %} +**Note**: This example shown with the coap-client instead of CoAP cli since CoAP cli does not support query parameters. Please refer to [Client libraries setup](#docsContent). +{% endcapture %} +{% include templates/info-banner.md content=difference %} + +**Execute the command:** + +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} +```shell +coap-client -m get "coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2" +``` +{: .copy-code} + +{% else %} + +```shell +coap-client -m get "coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2" +``` +{: .copy-code} {% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/request-attribute-values-certificate.md b/_includes/templates/api/coap/request-attribute-values-certificate.md index cbd18e6fc5..e7eebac43e 100644 --- a/_includes/templates/api/coap/request-attribute-values-certificate.md +++ b/_includes/templates/api/coap/request-attribute-values-certificate.md @@ -1,18 +1,40 @@ Send GET request to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 +coap://{{HOST_NAME}}/api/v1/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 ``` {: .copy-code} -Where **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address. +> ⚠️ Don't forget to replace {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + +{% else %} -{% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} ```shell coap://{{coapHostName}}/api/v1/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2 ``` {: .copy-code} +{% endif %} + +{% capture difference %} +**Note**: This example shown with the coap-client instead of CoAP cli since CoAP cli does not support query parameters. Please refer to [Client libraries setup](#docsContent). +{% endcapture %} +{% include templates/info-banner.md content=difference %} + +**Execute the command:** + +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} +```shell +coap-client -m get "coap://{{HOST_NAME}}/api/v1/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2" +``` +{: .copy-code} + +{% else %} + +```shell +coap-client -m get "coap://{{coapHostName}}/api/v1/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2" +``` +{: .copy-code} + {% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/server-side-rpc-access-token.md b/_includes/templates/api/coap/server-side-rpc-access-token.md index 78762966a7..3f2a58f0df 100644 --- a/_includes/templates/api/coap/server-side-rpc-access-token.md +++ b/_includes/templates/api/coap/server-side-rpc-access-token.md @@ -1,26 +1,25 @@ Send GET request with observe flag to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc +coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address; -- **$ACCESS_TOKEN** is device access token. - {% endif %} {% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} + ```shell coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/rpc ``` {: .copy-code} -Where **$ACCESS_TOKEN** is device access token. - {% endif %} +> Where {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN is your device's access token. + Once subscribed, a client may receive RPC requests. An example of RPC request body is shown below: ```json @@ -34,21 +33,22 @@ Once subscribed, a client may receive RPC requests. An example of RPC request bo } ``` -Where - -- **id** - request id, integer request identifier; -- **method** - RPC method name, string; -- **params** - RPC method params, custom json object. +> Where + • **id** - request id, integer request identifier + • **method** - RPC method name, string + • **params** - RPC method params, custom json object -and can reply to them using POST request to the following URL: +To reply to an RPC request, send a POST request to the following URL -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc/{$id} +coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc/{$id} ``` {: .copy-code} + {% endif %} {% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} + ```shell coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/rpc/{$id} ``` @@ -56,38 +56,31 @@ coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/rpc/{$id} {% endif %} -Where **$id** is an integer request identifier. +> Where $id is an integer request identifier. -
-**Let's look at an example**: +**Example** -- Use **RPC debug terminal** widget in your ThingsBoard instance; +- Use **RPC debug terminal** widget in your ThingsBoard instance. +- Subscribe to RPC commands from the server using the command below. To do this, in the first terminal window send GET request with observe flag: -{% if docsPrefix == null or docsPrefix == "pe/" %} -- Subscribe to RPC commands from the server using the command below. To do this, in the first terminal window send GET request with observe flag. Don't forget to replace $THINGSBOARD_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token: +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap-client -m get coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc -s 100 -B 100 +coap-client -m get coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc -s 100 -B 100 ``` {: .copy-code} + {% endif %} -{% if docsPrefix contains "paas/" %} -- Subscribe to RPC commands from the server using the command below. Don't forget to replace $ACCESS_TOKEN with your device's access token: +{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} ```shell coap-client -m get coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/rpc -s 100 -B 100 ``` {: .copy-code} -{% endif %} -{% if docsPrefix == "edge/" %} -- Subscribe to RPC commands from the server using the command below. Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host and $ACCESS_TOKEN with your device's access token: -```shell -coap-client -m get coap://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc -s 100 -B 100 -``` -{: .copy-code} {% endif %} + {% capture difference %} The "`s`" option stands for subscribe and the value has to be specified in seconds. @@ -95,35 +88,36 @@ The "`B`" options stands for break (the operation will be break after desired ti {% endcapture %} {% include templates/info-banner.md content=difference %} -- Send an RPC request "connect" to the device using **RPC debug terminal** widget; - -- Save the "[rpc-response.json](/docs/reference/resources/rpc-response.json)" file to your PC; - +- Send an RPC request "connect" to the device using **RPC debug terminal** widget. +- Save the [rpc-response.json](/docs/reference/resources/rpc-response.json){:target="_blank" download="rpc-response.json"} file to your PC. - In the second terminal window simulate sending a response from the device to the server: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap-client -f rpc-response.json -m post coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc/1 +coap-client -f rpc-response.json -m post coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/rpc/1 ``` {: .copy-code} + {% endif %} -{% if docsPrefix contains "paas/" %} +{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/" %} + ```shell cat rpc-response.json | coap post coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/rpc/1 ``` {: .copy-code} + {% endif %} -{% if docsPrefix == "edge/" %} -```shell -coap-client -f rpc-response.json -m post coap://$THINGSBOARD_EDGE_HOST_NAME/api/v1/$ACCESS_TOKEN/rpc/1 -``` -{: .copy-code} -{% endif %} -- You should receive a response from the device: +> ⚠️ Replace {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN with your device's access token. + +You should receive a response from the device: ```shell {"result":"ok"} ``` -{% include images-gallery.html imageCollection="server-side-rpc" %} \ No newline at end of file +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "paas/" or docsPrefix == "paas/eu/" %} +{% include images-gallery.html imageCollection="server-side-rpc" %} +{% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/server-side-rpc-certificate.md b/_includes/templates/api/coap/server-side-rpc-certificate.md index 5a933ac823..062dc2e0cc 100644 --- a/_includes/templates/api/coap/server-side-rpc-certificate.md +++ b/_includes/templates/api/coap/server-side-rpc-certificate.md @@ -1,15 +1,16 @@ Send GET request with observe flag to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/rpc +coap://{{HOST_NAME}}/api/v1/rpc ``` {: .copy-code} -Where **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address. - +> ⚠️ Where {{HOST_NAME}} is your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + {% endif %} {% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} + ```shell coap://{{coapHostName}}/api/v1/rpc ``` @@ -30,22 +31,23 @@ Once subscribed, a client may receive RPC requests. An example of RPC request bo } ``` -Where +> Where + • **id** - request id, integer request identifier + • **method** - RPC method name, string + • **params** - RPC method params, custom json object -- **id** - request id, integer request identifier; -- **method** - RPC method name, string; -- **params** - RPC method params, custom json object. +To reply to an RPC request, send a POST request to the following URL -and can reply to them using POST request to the following URL: +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} -{% if docsPrefix == null or docsPrefix == "pe/"%} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/rpc/{$id} +coap://{{HOST_NAME}}/api/v1/rpc/{$id} ``` {: .copy-code} {% endif %} {% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} + ```shell coap://{{coapHostName}}/api/v1/rpc/{$id} ``` @@ -53,37 +55,30 @@ coap://{{coapHostName}}/api/v1/rpc/{$id} {% endif %} -Where **$id** is an integer request identifier. +> Where $id is an integer request identifier.
-**Let's look at an example**: + +**Example** - Use **RPC debug terminal** widget in your ThingsBoard instance; +- Subscribe to RPC commands from the server using the command below. To do this, in the first terminal window send GET request with observe flag. -{% if docsPrefix == null or docsPrefix == "pe/" %} -- Subscribe to RPC commands from the server using the command below. To do this, in the first terminal window send GET request with observe flag. Don't forget to replace $THINGSBOARD_HOST_NAME with your host: +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap-client -m get coap://$THINGSBOARD_HOST_NAME/api/v1/rpc -s 100 -B 100 +coap-client -m get coap://{{HOST_NAME}}/api/v1/rpc -s 100 -B 100 ``` {: .copy-code} + {% endif %} {% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} -- Subscribe to RPC commands from the server using the command below: ```shell coap-client -m get coap://{{coapHostName}}/api/v1/rpc -s 100 -B 100 ``` {: .copy-code} {% endif %} -{% if docsPrefix == "edge/" %} -- Subscribe to RPC commands from the server using the command below. Don't forget to replace $THINGSBOARD_EDGE_HOST_NAME with your host: - -```shell -coap-client -m get coap://$THINGSBOARD_EDGE_HOST_NAME/api/v1/rpc -s 100 -B 100 -``` -{: .copy-code} -{% endif %} {% capture difference %} The "`s`" option stands for subscribe and the value has to be specified in seconds. @@ -92,30 +87,27 @@ The "`B`" options stands for break (the operation will be break after desired ti {% endcapture %} {% include templates/info-banner.md content=difference %} -- Send an RPC request "connect" to the device using **RPC debug terminal** widget; - -- Save the "[rpc-response.json](/docs/reference/resources/rpc-response.json)" file to your PC; - +- Send an RPC request "connect" to the device using **RPC debug terminal** widget. +- Save the [rpc-response.json](/docs/reference/resources/rpc-response.json){:target="_blank" download="rpc-response.json"} file to your PC. - In the second terminal window simulate sending a response from the device to the server: -{% if docsPrefix == null or docsPrefix == "pe/" %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap-client -f rpc-response.json -m post coap://$THINGSBOARD_HOST_NAME/api/v1/rpc/1 +coap-client -f rpc-response.json -m post coap://{{HOST_NAME}}/api/v1/rpc/1 ``` {: .copy-code} + +> ⚠️ Replace {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + + {% endif %} {% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} + ```shell cat rpc-response.json | coap post coap://{{coapHostName}}/api/v1/rpc/1 ``` {: .copy-code} {% endif %} -{% if docsPrefix == "edge/" %} -```shell -coap-client -f rpc-response.json -m post coap://$THINGSBOARD_EDGE_HOST_NAME/api/v1/rpc/1 -``` -{: .copy-code} -{% endif %} - You should receive a response from the device: @@ -123,4 +115,6 @@ coap-client -f rpc-response.json -m post coap://$THINGSBOARD_EDGE_HOST_NAME/api/ {"result":"ok"} ``` -{% include images-gallery.html imageCollection="server-side-rpc-certificate" %} \ No newline at end of file +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "paas/" or docsPrefix == "paas/eu/" %} +{% include images-gallery.html imageCollection="server-side-rpc-certificate" %} +{% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/subscribe-to-attribute-updates-access-token.md b/_includes/templates/api/coap/subscribe-to-attribute-updates-access-token.md index 4768e59523..29d66a4c59 100644 --- a/_includes/templates/api/coap/subscribe-to-attribute-updates-access-token.md +++ b/_includes/templates/api/coap/subscribe-to-attribute-updates-access-token.md @@ -1,22 +1,39 @@ Send GET request with Observe option to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/attributes +coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address; -- **$ACCESS_TOKEN** is device access token. +{% else %} -{% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} ```shell coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/attributes ``` {: .copy-code} -Where **$ACCESS_TOKEN** is device access token. +{% endif %} + +> ⚠️ Don't forget to replace {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN with your device's access token. + +Once shared attribute will be changed by one of the server-side components (REST API or Rule Chain) the client will receive the following update: + +**Execute the command:** + +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} +```shell +coap get -o coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/attributes +``` +{: .copy-code} + +{% else %} + +```shell +coap get -o coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/attributes +``` +{: .copy-code} {% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/subscribe-to-attribute-updates-certificate.md b/_includes/templates/api/coap/subscribe-to-attribute-updates-certificate.md index 521108d3c8..520086bdb2 100644 --- a/_includes/templates/api/coap/subscribe-to-attribute-updates-certificate.md +++ b/_includes/templates/api/coap/subscribe-to-attribute-updates-certificate.md @@ -1,18 +1,37 @@ Send GET request with Observe option to the following URL: -{% if docsPrefix == null or docsPrefix == "pe/"%} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/attributes +coap://{{HOST_NAME}}/api/v1/attributes ``` {: .copy-code} -Where **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address. +> ⚠️ Don't forget to replace {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + +{% else %} -{% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} ```shell coap://{{coapHostName}}/api/v1/attributes ``` {: .copy-code} +{% endif %} + +Once shared attribute will be changed by one of the server-side components (REST API or Rule Chain) the client will receive the following update: + +**Execute the command:** + +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} +```shell +coap get -o coap://{{HOST_NAME}}/api/v1/attributes +``` +{: .copy-code} + +{% else %} + +```shell +coap get -o coap://{{coapHostName}}/api/v1/attributes +``` +{: .copy-code} + {% endif %} \ No newline at end of file diff --git a/_includes/templates/api/coap/telemetry-upload-api-access-token.md b/_includes/templates/api/coap/telemetry-upload-api-access-token.md index 091698e3e9..17429ffd00 100644 --- a/_includes/templates/api/coap/telemetry-upload-api-access-token.md +++ b/_includes/templates/api/coap/telemetry-upload-api-access-token.md @@ -1,23 +1,20 @@ Send POST request to the following URL: -{% if (docsPrefix == null) or (docsPrefix == "pe/") %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry +coap://{{HOST_NAME}}/api/v1/$ACCESS_TOKEN/telemetry ``` {: .copy-code} -Where -- **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address; -- **$ACCESS_TOKEN** is device access token. - -{% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} +{% else %} ```shell coap://{{coapHostName}}/api/v1/$ACCESS_TOKEN/telemetry ``` {: .copy-code} -Where **$ACCESS_TOKEN** is device access token. +{% endif %} -{% endif %} \ No newline at end of file +> ⚠️ Don't forget to replace {% unless docsPrefix contains "paas/" %} + • {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. + • {% endunless %}$ACCESS_TOKEN with your device's access token. \ No newline at end of file diff --git a/_includes/templates/api/coap/telemetry-upload-api-certificate.md b/_includes/templates/api/coap/telemetry-upload-api-certificate.md index fc3695e81f..6902f18059 100644 --- a/_includes/templates/api/coap/telemetry-upload-api-certificate.md +++ b/_includes/templates/api/coap/telemetry-upload-api-certificate.md @@ -1,19 +1,18 @@ Send POST request to the following URL: -{% if (docsPrefix == null) or (docsPrefix == "pe/") %} +{% if docsPrefix == nil or docsPrefix == "pe/" or docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} ```shell -coap://$THINGSBOARD_HOST_NAME/api/v1/telemetry +coap://{{HOST_NAME}}/api/v1/telemetry ``` {: .copy-code} -Where **$THINGSBOARD_HOST_NAME** is your localhost, or the platform address. +> ⚠️ Don't forget to replace {{HOST_NAME}} with your ThingsBoard{% if docsPrefix == "edge/" or docsPrefix == "pe/edge/" %} Edge{% endif %} hostname or IP address. -{% endif %} -{% if docsPrefix == "paas/" or docsPrefix == "paas/eu/"%} +{% else %} ```shell coap://{{coapHostName}}/api/v1/telemetry ``` {: .copy-code} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/docs/edge/reference/coap-api.md b/docs/edge/reference/coap-api.md index d08c8990f7..ff7b26cfd4 100644 --- a/docs/edge/reference/coap-api.md +++ b/docs/edge/reference/coap-api.md @@ -4,4 +4,6 @@ title: CoAP Device API Reference redirect_from: "/docs/edge/reference/coap-api" --- +{% assign docsPrefix = "edge/" %} +{% include get-hosts-name.html docsTag="edge" %} {% include docs/reference/coap-api.md %} diff --git a/docs/edge/reference/http-api.md b/docs/edge/reference/http-api.md index 32a913a881..e1776099ac 100644 --- a/docs/edge/reference/http-api.md +++ b/docs/edge/reference/http-api.md @@ -5,4 +5,6 @@ description: Supported HTTP API Reference for IoT Devices redirect_from: "/docs/edge/reference/http-api" --- +{% assign docsPrefix = "edge/" %} +{% include get-hosts-name.html docsTag="edge" %} {% include docs/reference/http-api.md %} diff --git a/docs/edge/reference/lwm2m-api.md b/docs/edge/reference/lwm2m-api.md index ec00a498aa..99ba892854 100644 --- a/docs/edge/reference/lwm2m-api.md +++ b/docs/edge/reference/lwm2m-api.md @@ -161,4 +161,6 @@ deviceNoSec_create_save: --- +{% assign docsPrefix = "edge/" %} +{% include get-hosts-name.html docsTag="edge" %} {% include docs/reference/lwm2m-api.md %} \ No newline at end of file diff --git a/docs/edge/reference/mcp-server.md b/docs/edge/reference/mcp-server.md index 9c6ef2f93a..f7efa47eba 100644 --- a/docs/edge/reference/mcp-server.md +++ b/docs/edge/reference/mcp-server.md @@ -6,4 +6,5 @@ description: Provides a **natural language interface** for LLMs and AI agents to --- {% assign docsPrefix = "edge/" %} +{% include get-hosts-name.html docsTag="edge" %} {% include docs/reference/mcp-server.md %} diff --git a/docs/edge/reference/mqtt-api.md b/docs/edge/reference/mqtt-api.md index 4396b6c17d..458730baff 100644 --- a/docs/edge/reference/mqtt-api.md +++ b/docs/edge/reference/mqtt-api.md @@ -6,4 +6,5 @@ redirect_from: "/docs/edge/reference/mqtt-api" --- {% assign docsPrefix = "edge/" %} +{% include get-hosts-name.html docsTag="edge" %} {% include docs/reference/mqtt-api.md %} \ No newline at end of file diff --git a/docs/edge/reference/resources/mqtt-js-attributes-request.js b/docs/edge/reference/resources/mqtt-js-attributes-request.js index 21e294047d..0209cbb7f4 100644 --- a/docs/edge/reference/resources/mqtt-js-attributes-request.js +++ b/docs/edge/reference/resources/mqtt-js-attributes-request.js @@ -1,5 +1,5 @@ var mqtt = require('mqtt') -var client = mqtt.connect('mqtt://localhost',{ +var client = mqtt.connect('mqtt://localhost', { username: process.env.TOKEN }) diff --git a/docs/edge/reference/snmp-api.md b/docs/edge/reference/snmp-api.md index d5287de8df..4ec4a555a7 100644 --- a/docs/edge/reference/snmp-api.md +++ b/docs/edge/reference/snmp-api.md @@ -41,4 +41,6 @@ deviceProfileConfiguring5: image: /images/reference/snmp-api/snmp-api-device-profile-configuring-6-pe.png --- +{% assign docsPrefix = "edge/" %} +{% include get-hosts-name.html docsTag="edge" %} {% include docs/reference/snmp-api.md %} \ No newline at end of file diff --git a/docs/paas/eu/reference/resources/mqtt-js-attributes-request.js b/docs/paas/eu/reference/resources/mqtt-js-attributes-request.js index 6f0dbeb34f..c50f2f963b 100644 --- a/docs/paas/eu/reference/resources/mqtt-js-attributes-request.js +++ b/docs/paas/eu/reference/resources/mqtt-js-attributes-request.js @@ -1,5 +1,5 @@ var mqtt = require('mqtt') -var client = mqtt.connect('mqtt://{{hostName}}',{ +var client = mqtt.connect('mqtt://eu.thingsboard.cloud', { username: process.env.TOKEN }) diff --git a/docs/paas/reference/resources/mqtt-js-attributes-request.js b/docs/paas/reference/resources/mqtt-js-attributes-request.js index 6f0dbeb34f..e034eeb134 100644 --- a/docs/paas/reference/resources/mqtt-js-attributes-request.js +++ b/docs/paas/reference/resources/mqtt-js-attributes-request.js @@ -1,5 +1,5 @@ var mqtt = require('mqtt') -var client = mqtt.connect('mqtt://{{hostName}}',{ +var client = mqtt.connect('mqtt://thingsboard.cloud', { username: process.env.TOKEN }) diff --git a/docs/pe/edge/reference/coap-api.md b/docs/pe/edge/reference/coap-api.md index af524bf920..0187746a48 100644 --- a/docs/pe/edge/reference/coap-api.md +++ b/docs/pe/edge/reference/coap-api.md @@ -4,5 +4,6 @@ title: CoAP Device API Reference redirect_from: "/docs/pe/edge/reference/coap-api" --- -{% assign docsPrefix = "pe/" %} +{% assign docsPrefix = "pe/edge/" %} +{% include get-hosts-name.html docsTag="pe-edge" %} {% include docs/reference/coap-api.md %} diff --git a/docs/pe/edge/reference/http-api.md b/docs/pe/edge/reference/http-api.md index ec5970be99..c012e7f51d 100644 --- a/docs/pe/edge/reference/http-api.md +++ b/docs/pe/edge/reference/http-api.md @@ -5,5 +5,6 @@ description: Supported HTTP API Reference for IoT Devices redirect_from: "/docs/pe/edge/reference/http-api" --- -{% assign docsPrefix = "pe/" %} +{% assign docsPrefix = "pe/edge/" %} +{% include get-hosts-name.html docsTag="pe-edge" %} {% include docs/reference/http-api.md %} diff --git a/docs/pe/edge/reference/lwm2m-api.md b/docs/pe/edge/reference/lwm2m-api.md index bfabe9b032..44934c6f34 100644 --- a/docs/pe/edge/reference/lwm2m-api.md +++ b/docs/pe/edge/reference/lwm2m-api.md @@ -161,5 +161,6 @@ deviceNoSec_create_save: --- -{% assign docsPrefix = "pe/" %} +{% assign docsPrefix = "pe/edge/" %} +{% include get-hosts-name.html docsTag="pe-edge" %} {% include docs/reference/lwm2m-api.md %} \ No newline at end of file diff --git a/docs/pe/edge/reference/mcp-server.md b/docs/pe/edge/reference/mcp-server.md index 7c226c3ed2..890d27290e 100644 --- a/docs/pe/edge/reference/mcp-server.md +++ b/docs/pe/edge/reference/mcp-server.md @@ -6,4 +6,5 @@ description: Provides a **natural language interface** for LLMs and AI agents to --- {% assign docsPrefix = "pe/edge/" %} +{% include get-hosts-name.html docsTag="pe-edge" %} {% include docs/reference/mcp-server.md %} diff --git a/docs/pe/edge/reference/mqtt-api.md b/docs/pe/edge/reference/mqtt-api.md index 183ffa3fba..fb81f5d328 100644 --- a/docs/pe/edge/reference/mqtt-api.md +++ b/docs/pe/edge/reference/mqtt-api.md @@ -6,4 +6,5 @@ redirect_from: "/docs/pe/edge/reference/mqtt-api" --- {% assign docsPrefix = "pe/edge/" %} +{% include get-hosts-name.html docsTag="pe-edge" %} {% include docs/reference/mqtt-api.md %} \ No newline at end of file diff --git a/docs/pe/edge/reference/resources/mqtt-js-attributes-request.js b/docs/pe/edge/reference/resources/mqtt-js-attributes-request.js index 21e294047d..0209cbb7f4 100644 --- a/docs/pe/edge/reference/resources/mqtt-js-attributes-request.js +++ b/docs/pe/edge/reference/resources/mqtt-js-attributes-request.js @@ -1,5 +1,5 @@ var mqtt = require('mqtt') -var client = mqtt.connect('mqtt://localhost',{ +var client = mqtt.connect('mqtt://localhost', { username: process.env.TOKEN }) diff --git a/docs/pe/edge/reference/snmp-api.md b/docs/pe/edge/reference/snmp-api.md index ade1660eec..0c604a6831 100644 --- a/docs/pe/edge/reference/snmp-api.md +++ b/docs/pe/edge/reference/snmp-api.md @@ -41,5 +41,6 @@ deviceProfileConfiguring5: image: /images/reference/snmp-api/snmp-api-device-profile-configuring-6-pe.png --- -{% assign docsPrefix = "pe/" %} +{% assign docsPrefix = "pe/edge/" %} +{% include get-hosts-name.html docsTag="pe-edge" %} {% include docs/reference/snmp-api.md %} \ No newline at end of file diff --git a/docs/reference/resources/mqtt-js-attributes-request.js b/docs/reference/resources/mqtt-js-attributes-request.js index 21e294047d..0209cbb7f4 100644 --- a/docs/reference/resources/mqtt-js-attributes-request.js +++ b/docs/reference/resources/mqtt-js-attributes-request.js @@ -1,5 +1,5 @@ var mqtt = require('mqtt') -var client = mqtt.connect('mqtt://localhost',{ +var client = mqtt.connect('mqtt://localhost', { username: process.env.TOKEN })