Skip to content

Lua API Network

Leonard Ramminger edited this page Aug 10, 2026 · 1 revision

Lua API — Network (beez.net)

HTTP client (libcurl) for REST, downloads, and connectivity checks.

REST response shape

Every REST call returns:

Field Type Description
status number HTTP status
body string response body
ok boolean true for 2xx
headers table lowercase header names
error string? transport error message

Functions

Function Description
get(url, [headers]) HTTP GET
post(url, body, [headers]) HTTP POST
put(url, body, [headers]) HTTP PUT
delete(url, [headers]) HTTP DELETE
request(method, url, options) arbitrary method; options.body, options.headers, options.timeout, options.follow_redirects
upload(url, file_path, [headers]) multipart POST
download(url, dest, [options]) save to file → { path, bytes }
download_and_verify(url, dest, algo, hash, [options]) download + hash check
ping(url, [timeout]) { ok, status, ms, error? }
is_online([timeout]) boolean probe
set_proxy(url) / set_proxy(nil) process-wide proxy

Headers

local headers = {
    ["Content-Type"] = "application/json",
    Authorization = "Bearer " .. token,
}
local res = beez.net.get("https://api.example.com/v1/status", headers)

← Lua API Overview

Clone this wiki locally