http json-lookup()

Prev Next

With this function, you can read in a JSON file via HTTP. The complete file is read in as a JSON object, which you then can query later, see function "execute json xpath()".

The return value of the function is the HTTP response status code if parameter d is not used. With parameter d you can apply a JSONPath expression to the JSON object. The return value of the function is then the result of the JSONPath expression.

Parameters

Parameter

Description

a

The URL from which the JSON file is to be requested. Example: "http://example.com".

b

(optional) If "true", the HTTP request is executed through the DMZ server (if it exists). Default: "false".

c

Key name of the JSON object to be created in the cache.

d

The JSONPath expression.

e

(optional) The HTTP method to be used. Use the three dots to select a value. Default: "GET".

f

If the ID of an "HTTP" channel is specified here, the HTTP request is made using the connection parameters of this channel. This might be necessary if authentication is required. Note: You can select a channel with the button with the three dots and then receive the ID directly.

g

If you want to use additional HTTP headers in the HTTP request (or overwrite existing ones), the name of a map containing those headers can be specified here. The key of an entry in this map must be the name of the HTTP header and the value of the entry then is the value for this HTTP header.

Also see section “Adding file to request body” below.

h

Body data (not for GET, HEAD, DELETE).

i

(optional) If false, an occurring exception is ignored. Default: <empty> (== false).

j

(optional) The encoding. Default: UTF-8.

k

(optional) Timeout in seconds. Default: 90.

l

(optional) Number of retries. Default: 0. Note: This setting only applies if no status code is returned. If a status code 4xx or 5xx is returned, no retry is triggered. In this case, a manual error handling must be implemented.

m

(optional) If true, URL encoding of the query of URL a is performed. Default: false. Example: https://example.com?select id from mytable where num > 500 then becomes https://example.com?select%20id%20from%20mytable%20where%20num%20%3E%20500

n

(optional) If the JSONPath query returns an array containing special characters, such as the / character, these are escaped with the \ character by default. You can prevent this behaviour with settings this parameter to true. Default: false.

o

(optional) Redirection strategy. Allowed values: "DEFAULT", "DISABLE", "LAX". Default: "DEFAULT".

DEFAULT: For HEAD, redirect to HEAD. For POST, redirect to POST. For GET, redirect to GET. With one exception: if the status code “303” is returned, the redirect is always to GET.

DISABLE: There is no redirect at all.

LAX: This strategy honours the restrictions on automatic redirection of entity enclosing methods such as POST and PUT imposed by the HTTP specification. 302 Moved Temporarily, 301 Moved Permanently and 307 Temporary Redirect status codes will result in an automatic redirect of HEAD and GET methods only. POST and PUT methods will not be automatically redirected as requiring user confirmation.

Adding file to request body

You can use the map in parameter g to add a file to the request body. Add a key REQUEST_HTTP_CONTENT_PATH to the map and the absolute path to the file as value for this key. Parameter h will then be ignored.