HTTP – Block for generating HTTP GET or POST requests (obsolete)

Block SymbolLicensing group: ADVANCED
Qt SVG Document Exported by REXYGEN Studio postdata urldata TRG data BUSY DONE ERROR errId hterror HTTP

Function Description
The HTTP block is obsolete, replace it by the HTTP2 block.

The HTTP block performs a single shot HTTP request. Target address (URL) is defined by url parameter and urldata input. A final URL is formed in the way so that urldata input is simply added to url parameter.

A HTTP request is started by the rising edge (off on) on the TRG input. Then the BUSY output is set to on until a request is finished, which is signaled by the DONE=on output. In case of an error, the ERROR output is set. The errId output carries last error identified by REXYGEN system error code. The hterror output carries a HTTP status code. All data sent back by server to client is stored in the data output.

The block may be run in blocking or non-blocking mode which is specified by the BLOCKING parameter. In blocking mode, execution of a task is suspended until a request is finished. In non-blocking mode, the block performs only single operation depending on available data and execution of a task is not blocked. It is advised to always run HTTP block in non-blocking mode. It is however necessary to mention that on various operating systems some operations can not be performed in the non-blocking mode, so be careful and do not use this block in quick tasks (QTASK) or in tasks with short execution period. The non-blocking operation is best supported on GNU/Linux operating system. The maximal duration of a request performed by the HTTP block is specified by the timeout parameter.

The block supports user authentication using basic HTTP authentication method. User name and password may be specified by user and password parameters. The block also supports secure HTTP (HTTPS). It is also possible to let the block verify server’s certificate by setting the VERIFY parameter. SSL certificate of a server or server’s trusted certificate authority must be stored in the certificate parameter in a PEM format. The block does not support any certificate storage.

Parameters postmime and acceptmime specify MIME encoding of data being sent to server or expected encoding of a HTTP response.

Parameters nmax, postmax, and datamax specify maximum sizes of buffers allocated by the block. The nmax parameter is maximal size of any string parameter. The postmax parameter specifies a maximal size of postdata. The datamax parameter specifies a maximal size of data.

This block does not propagate the signal quality. More information can be found in the 1.4 section.

Input

postdata

Data to put in HTTP POST request

String

urldata

Data to append to URL address

String

TRG

Trigger of the selected action

Bool

Parameter

url

URL address to send the HTTP request to

String

method

HTTP request type  1

Long (I32)

1 ....

GET

2 ....

POST

3 ....

PUT

4 ....

DELETE

5 ....

HEAD

6 ....

TRACE

7 ....

PATCH

8 ....

OPTIONS

9 ....

CONNECT

user

User name

String

password

Password

String

certificate

Authentication certificate

String

VERIFY

Enable server verification (valid certificate)

Bool

postmime

MIME encoding for POST request  application/json

String

acceptmime

MIME encoding for GET request  application/json

String

timeout

Timeout interval  5.0

Double (F64)

BLOCKING

Wait for the operation to finish

Bool

nmax

Allocated size of string   0  65520

Long (I32)

postmax

Allocated memory for POST request data   128  65520 256

Long (I32)

datamax

Allocated memory for HTTP response   128  10000000 1024

Long (I32)

Output

data

Response data

String

BUSY

Sending HTTP request

Bool

DONE

HTTP request processed

Bool

ERROR

Error indicator

Bool

errId

Error code

Error

hterror

HTTP response

Long (I32)

2024 © REX Controls s.r.o., www.rexygen.com