Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[blockly] http block documentation #2359

Merged
merged 6 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configuration/blockly/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]]

Expand Down
21 changes: 17 additions & 4 deletions configuration/blockly/rules-blockly-http.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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)

Expand All @@ -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
Expand Down
Binary file modified configuration/images/blockly/blockly-http-delete-simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified configuration/images/blockly/blockly-http-get-simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified configuration/images/blockly/blockly-http-overview-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified configuration/images/blockly/blockly-http-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified configuration/images/blockly/blockly-http-post-complex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified configuration/images/blockly/blockly-http-post-simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified configuration/images/blockly/blockly-http-put-simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified configuration/images/blockly/blockly-http-toggles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading