From 4e42f0a33fa8806e93393c19fbc5fe9838aed7ee Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 13 Mar 2025 17:53:21 +0200 Subject: [PATCH 1/4] Added md help files for REST connector --- .../en_US/widget/lib/gateway/rest-json_fn.md | 53 +++++++++++++++++++ .../en_US/widget/lib/gateway/rest-url_fn.md | 53 +++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md create mode 100644 ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md new file mode 100644 index 0000000000..9b3012c00d --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md @@ -0,0 +1,53 @@ +### JSON Path: + +The expression field is used to extract data from the HTTP response message. + +JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: + +- `$`: The root element of the JSON document; +- `.`: Child operator used to select child elements. For example, $.store.book ; +- `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; + +### Examples: + +For example, if we want to extract the device name from the following message, we can use the expression below: + +HTTP response message: + +```json +{ + "sensorModelInfo": { + "sensorName": "AM-123", + "sensorType": "myDeviceType" + }, + "data": { + "temp": 12.2, + "hum": 56, + "status": "ok" + } +} +``` + +Expression: + +`${sensorModelInfo.sensorName}` + +Converted data: + +`AM-123` + +If we want to extract all data from the message above, we can use the following expression: + +`${data}` + +Converted data: + +`{"temp": 12.2, "hum": 56, "status": "ok"}` + +Or if we want to extract specific data (for example “temperature”), you can use the following expression: + +`${data.temp}` + +And as a converted data we will get: + +`12.2` diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md new file mode 100644 index 0000000000..eccb52b96e --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md @@ -0,0 +1,53 @@ +## Request URL expression + +JSONPath expression uses for creating url address to send a message. + +JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: + +- `$`: The root element of the JSON document; +- `.`: Child operator used to select child elements. For example, $.store.book ; +- `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; + +### Examples: + +For example, if we want to extract the device name from the following message, we can use the expression below: + +HTTP response message: + +```json +{ + "sensorModelInfo": { + "sensorName": "AM-123", + "sensorType": "myDeviceType" + }, + "data": { + "temp": 12.2, + "hum": 56, + "status": "ok" + } +} +``` + +Expression: + +`${sensorModelInfo.sensorName}` + +Converted data: + +`AM-123` + +If we want to extract all data from the message above, we can use the following expression: + +`${data}` + +Converted data: + +`{"temp": 12.2, "hum": 56, "status": "ok"}` + +Or if we want to extract specific data (for example “temperature”), you can use the following expression: + +`${data.temp}` + +And as a converted data we will get: + +`12.2` From 3061cc17bb18e73746ece4959d0a12e1de402c6d Mon Sep 17 00:00:00 2001 From: mpetrov Date: Tue, 18 Mar 2025 18:21:12 +0200 Subject: [PATCH 2/4] Updated md files --- .../en_US/widget/lib/gateway/rest-json_fn.md | 15 ++++++++------- .../en_US/widget/lib/gateway/rest-url_fn.md | 17 +++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md index 9b3012c00d..14e0a86d6a 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md @@ -1,6 +1,7 @@ -### JSON Path: +### Expressions +#### JSON Path -The expression field is used to extract data from the HTTP response message. +The expression field is used to specify the path for extracting data from an HTTP response message. JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: @@ -8,7 +9,7 @@ JSONPath expressions specify the items within a JSON structure (which could be a - `.`: Child operator used to select child elements. For example, $.store.book ; - `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; -### Examples: +#### Examples For example, if we want to extract the device name from the following message, we can use the expression below: @@ -28,7 +29,7 @@ HTTP response message: } ``` -Expression: +JSON Path Expression `${sensorModelInfo.sensorName}` @@ -36,7 +37,7 @@ Converted data: `AM-123` -If we want to extract all data from the message above, we can use the following expression: +For extracting all data from the message above, use: `${data}` @@ -44,10 +45,10 @@ Converted data: `{"temp": 12.2, "hum": 56, "status": "ok"}` -Or if we want to extract specific data (for example “temperature”), you can use the following expression: +For extracting a specific value, such as the temperature, use: `${data.temp}` -And as a converted data we will get: +Converted data: `12.2` diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md index eccb52b96e..33ff4e6172 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md @@ -1,14 +1,15 @@ -## Request URL expression +### Expressions +#### Request URL -JSONPath expression uses for creating url address to send a message. +JSONPath expressions are used to construct URL addresses for sending messages. -JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: +JSONPath expressions specify items within a JSON structure (objects, arrays, or a nested combination) that you wish to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: - `$`: The root element of the JSON document; - `.`: Child operator used to select child elements. For example, $.store.book ; - `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; -### Examples: +#### Examples For example, if we want to extract the device name from the following message, we can use the expression below: @@ -28,7 +29,7 @@ HTTP response message: } ``` -Expression: +Url Expression: `${sensorModelInfo.sensorName}` @@ -36,7 +37,7 @@ Converted data: `AM-123` -If we want to extract all data from the message above, we can use the following expression: +For extracting all data from the message above, use: `${data}` @@ -44,10 +45,10 @@ Converted data: `{"temp": 12.2, "hum": 56, "status": "ok"}` -Or if we want to extract specific data (for example “temperature”), you can use the following expression: +For extracting specific data (e.g., "temperature"), use: `${data.temp}` -And as a converted data we will get: +Converted data: `12.2` From 9ff052e9c06bf3f33ad328382ec27a9838e259ea Mon Sep 17 00:00:00 2001 From: mpetrov Date: Tue, 18 Mar 2025 18:25:51 +0200 Subject: [PATCH 3/4] Updated md files --- .../src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md | 4 ++-- .../src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md index 14e0a86d6a..fe41a2c610 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md @@ -37,7 +37,7 @@ Converted data: `AM-123` -For extracting all data from the message above, use: +To extract all data from the message above, use: `${data}` @@ -45,7 +45,7 @@ Converted data: `{"temp": 12.2, "hum": 56, "status": "ok"}` -For extracting a specific value, such as the temperature, use: +To extract a specific value, such as the temperature, use: `${data.temp}` diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md index 33ff4e6172..a30deb6203 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md @@ -37,7 +37,7 @@ Converted data: `AM-123` -For extracting all data from the message above, use: +To extract all data from the message above, use: `${data}` @@ -45,7 +45,7 @@ Converted data: `{"temp": 12.2, "hum": 56, "status": "ok"}` -For extracting specific data (e.g., "temperature"), use: +To extract specific data (e.g., "temperature"), use: `${data.temp}` From 3b925df445da22512171d29ee8ee4673acf92829 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 19 Mar 2025 14:22:53 +0200 Subject: [PATCH 4/4] Updated md files --- .../en_US/widget/lib/gateway/rest-json_fn.md | 52 +++++++++--------- .../en_US/widget/lib/gateway/rest-url_fn.md | 54 ------------------- 2 files changed, 24 insertions(+), 82 deletions(-) delete mode 100644 ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md index fe41a2c610..32143694df 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md @@ -1,9 +1,11 @@ ### Expressions #### JSON Path -The expression field is used to specify the path for extracting data from an HTTP response message. +The expression field is used to specify the path for extracting data from an incoming HTTP request body. -JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: +JSONPath expressions specifies the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. +These expressions can select elements from JSON data on specific criteria. +Basic overview of how JSONPath expressions are structured: - `$`: The root element of the JSON document; - `.`: Child operator used to select child elements. For example, $.store.book ; @@ -11,9 +13,7 @@ JSONPath expressions specify the items within a JSON structure (which could be a #### Examples -For example, if we want to extract the device name from the following message, we can use the expression below: - -HTTP response message: +Incoming request body: ```json { @@ -25,30 +25,26 @@ HTTP response message: "temp": 12.2, "hum": 56, "status": "ok" - } + }, + "rxInfo": [ + { + "rssi": 50, + "snr": 3 + }, + { + "rssi": 22, + "snr": 1 + } + ] } ``` +
-JSON Path Expression - -`${sensorModelInfo.sensorName}` - -Converted data: - -`AM-123` - -To extract all data from the message above, use: - -`${data}` - -Converted data: - -`{"temp": 12.2, "hum": 56, "status": "ok"}` - -To extract a specific value, such as the temperature, use: - -`${data.temp}` - -Converted data: +Examples below shows on how to extract values from incoming request body. -`12.2` +| JSON Path Expression | Extracted data | +|---------------------------------|---------------------------------------------| +| `${sensorModelInfo.sensorName}` | `AM-123` | +| `${data}` | `{"temp": 12.2, "hum": 56, "status": "ok"}` | +| `${$.data.temp}` | `12.2` | +| `${$.rxInfo[0].rssi}` | `50` | diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md deleted file mode 100644 index a30deb6203..0000000000 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md +++ /dev/null @@ -1,54 +0,0 @@ -### Expressions -#### Request URL - -JSONPath expressions are used to construct URL addresses for sending messages. - -JSONPath expressions specify items within a JSON structure (objects, arrays, or a nested combination) that you wish to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: - -- `$`: The root element of the JSON document; -- `.`: Child operator used to select child elements. For example, $.store.book ; -- `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; - -#### Examples - -For example, if we want to extract the device name from the following message, we can use the expression below: - -HTTP response message: - -```json -{ - "sensorModelInfo": { - "sensorName": "AM-123", - "sensorType": "myDeviceType" - }, - "data": { - "temp": 12.2, - "hum": 56, - "status": "ok" - } -} -``` - -Url Expression: - -`${sensorModelInfo.sensorName}` - -Converted data: - -`AM-123` - -To extract all data from the message above, use: - -`${data}` - -Converted data: - -`{"temp": 12.2, "hum": 56, "status": "ok"}` - -To extract specific data (e.g., "temperature"), use: - -`${data.temp}` - -Converted data: - -`12.2`