diff --git a/configuration/blockly/index.md b/configuration/blockly/index.md index 4c87003bdc..0467f2e8ca 100644 --- a/configuration/blockly/index.md +++ b/configuration/blockly/index.md @@ -9,7 +9,7 @@ title: Rules Blockly One of the core feature that openHAB provides is writing rules to allow specific behaviour with the home automation system. The usual way of developing rules is by coding them like described in the [Textual Rules](/docs/configuration/rules-dsl.html). -The art of textual programming may become intimidating early on and shy away away people with few or almost no experience in programming. So, if you are not a member of the professional coder community or do not have equivalent skills, the ability to create your programs visually might be the ideal option (even though some programming background may still help or can evolve over time). Therefore openHAB also provides a graphical way of writing rules which allows to put together rules in a visual way: Welcome to the world of openHAB Blockyl. +The art of textual programming may become intimidating early on and shy away away people with few or almost no experience in programming. So, if you are not a member of the professional coder community or do not have equivalent skills, the ability to create your programs visually might be the ideal option (even though some programming background may still help or can evolve over time). Therefore openHAB also provides a graphical way of writing rules which allows to put together rules in a visual way: Welcome to the world of openHAB Blockly. [[toc]] diff --git a/configuration/blockly/rules-blockly-http.md b/configuration/blockly/rules-blockly-http.md index fc900aa6a7..2367cec1eb 100644 --- a/configuration/blockly/rules-blockly-http.md +++ b/configuration/blockly/rules-blockly-http.md @@ -21,12 +21,13 @@ Depending on the required functionality it changes its design. ### Option Toggles -There are two toggle buttons that allow the block to be small for simple requests and add further options to be used: +There are three toggle buttons that allow the block to be small for simple requests and add further options to be used: ![http-toggle](../images/blockly/blockly-http-toggles.png) - Clock: enables the timeout option - H: enables the header option and allows to provide headers during the request via a [Dictionary](rules-blockly-standard-ext.md#dictionary-for-managing-key--value-pairs) +- Q: enables the query option and allows to provide URI query parameters during the request via a [Dictionary](rules-blockly-standard-ext.md#dictionary-for-managing-key--value-pairs), the query parameters will be URI encoded ### HTTP Request GET @@ -36,8 +37,15 @@ The simplest form is shown by default and accepts the destination URI as String. ![http-get-simple](../images/blockly/blockly-http-get-simple.png) -By activating the toggles the timeout and request headers can be provided. -See the [POST-Request](#http-request-post) below for an example showing these additional fields. +By activating the toggles the timeout, request headers and query parameters can be provided. +Instead of creating a URI containing the query parameters, you can use the query parameter option and provide a [Dictionary](rules-blockly-standard-ext.md#dictionary-for-managing-key--value-pairs) of query parameters. +The provided parameters will automatically be URI encoded. + +Here is an example also using a query parameter. + +![http-get-complex](../images/blockly/blockly-http-get-complex.png) + +See the [POST-Request](#http-request-post) below for an example showing the use additional fields. ### HTTP Request POST @@ -48,9 +56,12 @@ The simplest form is shown by default and accepts the destination URI as String - the MIME-type of the content to be sent - the content to be sent to the destination +For MIME-type `application/json` you can provide an object as content, and it will be converted to a JSON string. +For `application/x-www-form-urlencoded`, you can provide a [Dictionary](rules-blockly-standard-ext.md#dictionary-for-managing-key--value-pairs) and it will be URI encoded. + ![http-post-simple](../images/blockly/blockly-http-post-simple.png) -Here is a more complex example that additionally sets a header and the timeout: +Here is a more complex example that additionally sets a header and a timeout: ![http-post-complex](../images/blockly/blockly-http-post-complex.png) @@ -65,6 +76,8 @@ The simplest form is shown by default and accepts the destination URI as String ![http-put-simple](../images/blockly/blockly-http-put-simple.png) +Notice the construction of an object with a [Dictionary](rules-blockly-standard-ext.md#dictionary-for-managing-key--value-pairs) also containing a List for the JSON payload. + ### HTTP Request DELETE _Function:_ Send an HTTP DELETE request to a server and receive the response diff --git a/configuration/images/blockly/blockly-http-delete-simple.png b/configuration/images/blockly/blockly-http-delete-simple.png index bca9397ef9..6b418216d4 100644 Binary files a/configuration/images/blockly/blockly-http-delete-simple.png and b/configuration/images/blockly/blockly-http-delete-simple.png differ diff --git a/configuration/images/blockly/blockly-http-get-complex.png b/configuration/images/blockly/blockly-http-get-complex.png new file mode 100644 index 0000000000..95f1aa6de7 Binary files /dev/null and b/configuration/images/blockly/blockly-http-get-complex.png differ diff --git a/configuration/images/blockly/blockly-http-get-simple.png b/configuration/images/blockly/blockly-http-get-simple.png index f9046ed622..75ac3b8971 100644 Binary files a/configuration/images/blockly/blockly-http-get-simple.png and b/configuration/images/blockly/blockly-http-get-simple.png differ diff --git a/configuration/images/blockly/blockly-http-overview-small.png b/configuration/images/blockly/blockly-http-overview-small.png index 5f9ff4e08c..269d53deba 100644 Binary files a/configuration/images/blockly/blockly-http-overview-small.png and b/configuration/images/blockly/blockly-http-overview-small.png differ diff --git a/configuration/images/blockly/blockly-http-overview.png b/configuration/images/blockly/blockly-http-overview.png index 75b93f3c8a..de71933f0f 100644 Binary files a/configuration/images/blockly/blockly-http-overview.png and b/configuration/images/blockly/blockly-http-overview.png differ diff --git a/configuration/images/blockly/blockly-http-post-complex.png b/configuration/images/blockly/blockly-http-post-complex.png index 6fbc0ec232..eadf9bf2a3 100644 Binary files a/configuration/images/blockly/blockly-http-post-complex.png and b/configuration/images/blockly/blockly-http-post-complex.png differ diff --git a/configuration/images/blockly/blockly-http-post-simple.png b/configuration/images/blockly/blockly-http-post-simple.png index 0fb7f0e517..da6b6f951d 100644 Binary files a/configuration/images/blockly/blockly-http-post-simple.png and b/configuration/images/blockly/blockly-http-post-simple.png differ diff --git a/configuration/images/blockly/blockly-http-put-simple.png b/configuration/images/blockly/blockly-http-put-simple.png index 2645c94ac2..de617ef5f0 100644 Binary files a/configuration/images/blockly/blockly-http-put-simple.png and b/configuration/images/blockly/blockly-http-put-simple.png differ diff --git a/configuration/images/blockly/blockly-http-toggles.png b/configuration/images/blockly/blockly-http-toggles.png index a57d4062c3..f601f54288 100644 Binary files a/configuration/images/blockly/blockly-http-toggles.png and b/configuration/images/blockly/blockly-http-toggles.png differ