HTTP – HTTP GET or POST request (obsolete)
Block SymbolLicensing group: ADVANCED
Function Description
The HTTP block performs a single HTTP GET or POST 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.
HTTP request is started by the TRG parameter. Then the BUSY output is set until a request is finished, which is signaled by the DONE 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 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 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.
Inputs
postdata | Data to put in HTTP POST request | String |
urldata | Data to append to URL address | String |
TRG | Trigger of the selected action | Bool |
Parameters
url | URL address to send the HTTP request to | String |
method | HTTP request type 1 | Long (I32) |
|
|
|
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 of HTTP response 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) |
Outputs
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) |
[Previous] [Back to top] [Up] [Next]
2020 © REX Controls s.r.o., www.rexygen.com