Function Block HTTP_RESPONSE

The Function Block HTTP_RESPONSE decodes a RAW response from the HTTP interface.

Important: The receive variable of the HTTP interface must have the data type RAW.

Input Response

The input expects a string in JSON format. It is usually connected directly to the feedback or receive variable of the interface.

Input ID

The input defines the ID of the query. The ID is generated during the query at the Function Block HTTP_REQUEST. This ensures that only the response of the request with the corresponding ID is processed. If the input is not defined, every response is evaluated.

Input Reset

If the input is true, all outputs are reset to NULL. As long as this input is true, the values for the outputs are not calculated.

Output Method

The output returns the transmission method as a string. This can be e.g. "GET", "POST", "PUT" or similar.

Output Type

The output returns the header Content-Type as a string.

Output Header

The output returns all header entries as a string. Multiple headers are separated by a line break.

Output Query

The output returns the query as a string. The query is the value after the question mark and is usually used in GET requests.

http://server/uri?query

The structure of a query looks like this:

var1=wert1&var2=wert2&va...

To ensure that the values are transferred correctly, it is advisable to decode the individual values with the Function Block URL_DECODE or QUERY_DECODE, as the data may possibly be transmitted incompletely.

Note: Note the maximum length of a URL if larger amounts of data need to be transferred. Use the POST method if necessary and receive the query as content.

Output Content

The output Content is similar to that of the output Query. However, the data is transmitted after the header and larger amounts of data are supported. Depending on the application, the type of Content may not have a Query method.

Note: Only UTF-8 compliant data is supported. When transferring binary data, it is recommended to encode it with the Function Block BASE64_ENCODE.

Output Length

The output returns the length of the input Content in bytes.

Output Status

The output returns the HTTP status as a number. For example, 200, 404 or similar. If no status was received, the value NULL is returned.

Output Error

The output is true if the input Status does not return 200 or NULL.

Output ErrNum

The output returns the cURL error number. If this is 0, no error occurred during transmission.

Output ErrStr

The output returns the error text for the cURL query.