This page is part of archived documentation for openHAB 4.3. Go to the current stable version

# HTTP

return to Blockly Reference

# Introduction

This section explains the blocks that allow sending HTTP requests.

# HTTP Requests

There is one block that handles all type of requests. Depending on the required functionality it changes its design.

http-overview

# Option Toggles

There are two toggle buttons that allow the block to be small for simple requests and add further options to be used:

http-toggle

  • Clock: enables the timeout option
  • H: enables the header option and allows to provide headers during the request via a Dictionary

# HTTP Request GET

Function: Send an HTTP GET request to a server and receive the response

The simplest form is shown by default and accepts the destination URI as String.

http-get-simple

By activating the toggles the timeout and request headers can be provided. See the POST-Request below for an example showing these additional fields.

# HTTP Request POST

Function: Send an HTTP POST request to a server and receive the response

The simplest form is shown by default and accepts the destination URI as String and in comparison to the GET-Request adds a section for the payload which takes two parameters:

  • the MIME-type of the content to be sent
  • the content to be sent to the destination

http-post-simple

Here is a more complex example that additionally sets a header and the timeout:

http-post-complex

# HTTP Request PUT

Function: Send an HTTP PUT request to a server and receive the response

The simplest form is shown by default and accepts the destination URI as String and is similar in functionality to the POST-Request:

  • the MIME-type of the content to be sent
  • the content to be sent to the destination

http-put-simple

# HTTP Request DELETE

Function: Send an HTTP DELETE request to a server and receive the response

The simplest form is shown by default and accepts the destination URI as String.

http-delete-simple

# Return to Blockly Reference

return to Blockly Reference