Global ObjectNetwork and IntegrationFactory Global

Request(url)

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:

Detailed Explanation

This section explains when to use the API, how to call it, and which structures it works best with in production flow.

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>(...).

When To Use It

For network integration, use HTTPS only, keep the response size bounded, and validate the response code before moving into JSON or File steps.

Parameters and Return

Request offers 13 methods; each method page lists its parameters and return value.

Best Combined With

The most common pattern is to check a Request response with getResponseCode(), read its body with getData() and parse it with JSON.parse().

Example Usage

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())
end

Copyable Progressive Examples

From 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.

Foundation

Shows the shortest direct way to call the API.

Foundation
local res = Request.get("https://example.com/api/status")
if res:getResponseCode() == 200 then
  local data = JSON.parse(res:getData())
end

Simple

Wraps the base call with minimal flow control.

Simple
local 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.

Practical Flow

A practical pattern for real macros with pcall, logging, and guards.

Practical Flow
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)

Detailed

This level packages the API into a reusable helper with error reporting.

Detailed
-- 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)
end

Combined

Combines the API with related structures to form a more realistic workflow.

Combined
local 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")