How To Call It
Request is a callable factory table: object methods are called as request:<method>(...), and the table’s own functions as Request.<method>(...).
HTTPS requests. Short calls such as Request.get(url) take only the address; for headers, a body or retries create a request object with Request(url) and configure it. Read the response with getResponseCode() and getData().
Documented for app version 1.0.51Updated:
Request is a callable factory table: object methods are called as request:<method>(...), and the table’s own functions as Request.<method>(...).
For network integration, use HTTPS only, keep the response size bounded, and validate the response code before moving into JSON or File steps.
Request offers 13 methods; each method page lists its parameters and return value.
The most common pattern is to check a Request response with getResponseCode(), read its body with getData() and parse it with JSON.parse().
The snippet below is a starter pattern that can be applied directly in runtime flow.
local res = Request.get("https://example.com/api/status")
if res:getResponseCode() == 200 then
local data = JSON.parse(res:getData())
endFrom foundation to combined usage, each level is provided as a separate code block so you can copy the level you need and adapt it directly.
local res = Request.get("https://example.com/api/status")
if res:getResponseCode() == 200 then
local data = JSON.parse(res:getData())
endlocal res = Request.get("https://example.com/api/status")
if res:getResponseCode() == 200 then
local data = JSON.parse(res:getData())
end
-- Continue with one focused method on the object.local res = Request.get("https://example.com/api/status")
if res:getResponseCode() == 200 then
local data = JSON.parse(res:getData())
end
local note = "Request overview loaded"
print(note)-- For network integration, use HTTPS only, keep the response size bounded, and validate the response code before moving into JSON or File steps.
local function run_request_step()
local res = Request.get("https://example.com/api/status")
if res:getResponseCode() == 200 then
local data = JSON.parse(res:getData())
end
end
local ok, err = pcall(run_request_step)
if not ok then
toast("Step failed")
print(err)
endlocal res = Request.get("https://example.com/api/status")
if res:getResponseCode() == 200 then
local data = JSON.parse(res:getData())
end
KV.set("last_network_step", DateTime.now():format("yyyy-MM-dd HH:mm:ss"))
print("Network step finished")