esi-http
esi-http offers the most simple interface to fetch data from external web servers.
Changes
version | date | description |
---|---|---|
1.0.3 |
2020-12-08 |
TFS code synchronisation |
1.0.2 |
2020-03-10 |
Fix links in the Available Functions section |
0.0.0 |
2018-06-16 |
Initial release |
Available functions
All functions have to be called according to the ESI standard, using colons, e.g. lib:FUNCTIONNAME(params)
Documentation
QUERYDATA
:QUERYDATA(pars)
This function executes one or multiple HTTP requests against a web server. It can either call a web site with no authentication, basic authentication or token-based authentication.
The data fetched from the web server is returned by the function either as a Lua table, a JSON document or native (as
retrieved from the server). The latter two are of type string
.
Scenario | Mandatory Parameters |
---|---|
The HTTP server supports (or requires) no authentication. |
URL |
The HTTP server supports (or requires) basic authentication. |
URL, USER, PWD |
The HTTP server supports (or requires) token-based auhentication. In this case, QUERYDATA will use 'POST' commands to obtain the token and the data |
HEADERFIELD, URL, USER, PWD |
QUERYDATA Parameters
pars (table
, required)
The pars
table must supply all mandatory parameters according to the call type described above.
Field | Data Type | Meaning |
---|---|---|
ENC |
|
the encoding to be used. The current version only supports JSON. As such, you may either supply "JSON" or simply ommit the field. |
HEADERFIELD |
|
The field in the POST header, which will be used to transmit the authentication token (token-based authentication only) |
URL |
|
the URL to invoke with the HTTP 'GET' command. This is either the single call when operating in simple mode, or the second call after the authentication token has been retrieved in two-step authenticating mode. |
QUERYDATA returns
Value | Data Type | Meaning |
---|---|---|
#1 |
|
Success indicator. If this is |
#2 |
|
The data which was returned by the server in the desired format (either |