If you like BoxMatrix then please contribute Supportdata, Supportdata2, Firmware and/or Hardware (get in touch).
My metamonk@yahoo.com is not reachable by me since years. Please use hippie2000@webnmail.de instead.

0
U

Property:api.lua

From BoxMatrix


BoxMatrix >> Webinterface >> api.lua @ BoxMatrix   -   IRC-Chat   -   Translate: de es fr it nl pl
News Selectors Models Accessories Components Environment Config Commands System Webif Software Develop Lexicon Community Project Media

UI-Structure UI-Modules HTML-Files XML-Files Lua-Scripts Javascript Browser SSI-Files SSI-Directives HTML-Text Event-Text Help-Pages CSS-Files Graphics Research

Lua-Script

Goto:   Functions  -  Dependencies   -   Model-Matrix   -   SMW-Browser

Details

api.lua is the REST-API Lua-Land root script. It is the only script loaded by scgi_server.
All other Lua-Land scripts are a tree of depenencies of api.lua or loaded by one of these,

scgi_server loads api.lua (and its depenencies) persistent and calls the cgi_load_callback function on startup.
Each API request then just calls the function cgi_start_callback without having to load or execute anything again.
This speeds up CGI horribly. You may know this principle from FastCGI.

The REST-API is accessed via HTTP on Port-8187-tcp using the request methods GET, PUT, POST and DELETE.
Arguments are passed as parts of the request URI and optionally in the request body. Results are returned in the body.
The URI contains the root path /api, the current version /v0 and at least the /<endpoint>, ie:

GET /api/v0/<endpoint>[/....]

An endpoint is a group of topic related functions. Endpoints for UI-Modules are created by api_generic.lua.
These are extensible by custom modules collected by rest_config.lua.

The mapping of request URLs to action functions of endpoints is performed by espresso.lua objetcs.
These are created one object each URL, request method and action function. Yet another method to speed up access.

User management and login procedure is inherited from the Webinterface. A login yields a session id,
which is connected to a permission mask managed in the rights ui-module for the currently logged in user.
These masks are used in security.lua to manage access perrmissions per endpoint and access origin (local, internet).

REST-API:

Functions

The function names of scripts often help to understand function blocks (and show gaps in the docs). fw 7.50 functions:

$ grep -e '^function' -e '^local function' /usr/rest_api/api.lua

# Load the resource configurations from different lua modules, if not already loaded.
# Loads rest_config.lua.
local function load_resource_configurations()

# Load the resource configurations from different lua modules, if not already loaded.
# Loads dev_debug.lua.
local function load_dev_debug()

# Build an URL with HTTP or HTTPS.
local function build_url(secure, hostnameorip, port, path)

# todo
function build_server_url(path)

# Create a table with endpoints and their required rights.
local function insert_security_context_by_endpoint(modules, access_type)

# Generate and send the overview, over all available modules and their urls.
local function send_overview()

# Error handler, used if no route to a given url/method pair could be found.
local function not_found()

# Makes the intersection of the two input tables.
local function table_intersection(data, pattern)

# Makes a config_flag query.
local function get_config_flags()

# Helper function to create espresso endpoints.
local function create_espresso_api_endpoints(resources)

# Defined by the scgi server. Gets called on scgi server boot.
# Defines a list of known UI-Modules and configures the url routing tree.
function cgi_load_callback()

# Defined by the scgi server. Gets called to process an incoming API request.
# Simply search the routing tree for the appropriate handler function.
function cgi_start_callback() 

Dependencies

Daily updated index of all dependencies of this script. Last update: 2024-04-19 08:52 GMT.
A * in the Mod column marks info from Supportdata-Probes, which will always stay incomplete.
If an Object includes itself then this is a file with the same name but another Path and the dependencies are merged.

Relation Typ Object Mod Firmware Info Origin
Requires lib libluaevent.so 15 7.39 Lua-Library for event handling AVM
Requires lua api_generic.lua 50 7.39 - 7.90 REST-API Generic Endpoints AVM
Requires lua api_generic_filter.lua 50 7.39 - 7.90 REST-API UI-Modules Webvar Filter AVM
Requires lua avmluamessages.lua 50 7.39 - 7.90 REST-API Debug Message Printer AVM
Requires lua dev_debug.lua 50 7.39 - 7.90 REST-API Developers Debugging Module AVM
Requires lua espresso.lua 50 7.39 - 7.90 REST-API URL to function router AVM
Requires lua landevice.lua 15 7.39 REST-API wrapper for the landevice ui-module AVM
Requires lua query_tree.lua 15 7.39 REST-API Helper to dump a complete UI-Module AVM
Requires lua response.lua 50 7.39 - 7.90 REST-API Response API AVM
Requires lua rest_api_const.lua 50 7.39 - 7.90 REST-API Const Tables AVM
Requires lua rest_config.lua 50 7.39 - 7.90 REST-API Module Loader AVM
Requires lua security.lua 50 7.39 - 7.90 REST-API Security AVM
Requires lua uimod.lua 15 7.39 REST-API UI-Modules API AVM
Includes js box.js 15 7.39 TODO AVM
14 dependencies for this script

Model-Matrix

Daily updated index of the presence, path and size of this script for each model. Last update: 2024-04-19 06:26 GMT.
Showing all models using this script. Click any column header (click-wait-click) to sort the list by the respective data.
The (main/scrpn/boot/arm/prx/atom) label in the Model column shows which CPU is meant for models with multiple Linux instances.
Note that this list is merged from Firmware-Probes of all known AVM firmware for a model, including Recovery.exe and Labor-Files.

Model Firmware Path Size/Bytes
FRITZ!Box 4020 7.39 /usr/rest_api 10.3k
FRITZ!Box 4040 7.39 - 7.57 /usr/rest_api 10.3k
FRITZ!Box 4050 7.57 /usr/rest_api 10.3k
FRITZ!Box 4060 7.39 - 7.57 /usr/rest_api 10.3k
FRITZ!Box 5530 Fiber (main) 7.39 - 7.80 /usr/rest_api 10.3k - 14.8k
FRITZ!Box 5590 Fiber (arm) 7.39 - 7.90 /usr/rest_api 10.3k - 19.2k
FRITZ!Box 5590 Fiber (prx) 7.70 - 7.90 /usr/rest_api 14.8k - 19.2k
FRITZ!Box 5690 Pro (arm) 7.59 /usr/rest_api 10.3k
FRITZ!Box 6430 Cable (arm) 7.57 /usr/rest_api 10.3k
FRITZ!Box 6490 Cable (arm) 7.39 - 7.57 /usr/rest_api 10.3k
FRITZ!Box 6490 Cable (atom) 7.39 - 7.51 /usr/rest_api 10.3k
FRITZ!Box 6590 Cable (arm) 7.39 - 7.57 /usr/rest_api 10.3k
FRITZ!Box 6590 Cable (atom) 7.39 - 7.51 /usr/rest_api 10.3k
FRITZ!Box 6591 Cable (arm) 7.39 - 7.57 /usr/rest_api 10.3k - 19.8k
FRITZ!Box 6591 Cable (atom) 7.39 - 7.57 /usr/rest_api 10.3k - 19.8k
FRITZ!Box 6660 Cable (arm) 7.39 - 7.57 /usr/rest_api 10.3k - 19.8k
FRITZ!Box 6660 Cable (atom) 7.39 - 7.57 /usr/rest_api 10.3k - 19.8k
FRITZ!Box 6670 Cable (arm) 7.57 - 7.62 /usr/rest_api 10.3k
FRITZ!Box 6670 Cable (atom) 7.61 - 7.62 /usr/rest_api 10.3k
FRITZ!Box 6690 Cable (arm) 7.39 - 7.57 /usr/rest_api 10.3k - 19.4k
FRITZ!Box 6690 Cable (atom) 7.39 - 7.57 /usr/rest_api 10.3k - 19.4k
FRITZ!Box 6820 LTE v1 7.39 - 7.51 /usr/rest_api 10.3k
FRITZ!Box 6820 LTE v2 7.39 - 7.51 /usr/rest_api 10.3k
FRITZ!Box 6820 LTE v3 7.39 - 7.57 /usr/rest_api 10.3k
FRITZ!Box 6840 LTE 7.39 /usr/rest_api 10.3k
FRITZ!Box 6850 LTE 7.39 - 7.58 /usr/rest_api 10.3k - 19.4k
FRITZ!Box 6850 5G 7.39 - 7.51 /usr/rest_api 10.3k
FRITZ!Box 6890 LTE 7.39 - 7.51 /usr/rest_api 10.3k - 19.4k
FRITZ!Box 6890 LTE v1 7.39 - 7.51 /usr/rest_api 10.3k - 19.4k
FRITZ!Box 6890 LTE v2 7.39 - 7.51 /usr/rest_api 10.3k - 19.4k
FRITZ!Box 7272 7.39 /usr/rest_api 10.3k
FRITZ!Box 7430 7.39 /usr/rest_api 10.3k
FRITZ!Box 7490 (main) 7.39 - 7.57 /usr/rest_api 10.3k
FRITZ!Box 7510 7.39 - 7.57 /usr/rest_api 10.3k
FRITZ!Box 7520 7.39 - 7.51 /usr/rest_api 10.3k
FRITZ!Box 7520 v2 (arm) 7.39 - 7.57 /usr/rest_api 10.3k
FRITZ!Box 7530 7.39 - 7.56 /usr/rest_api 10.3k - 19.8k
FRITZ!Box 7530 AX 7.39 - 7.90 /usr/rest_api 10.3k - 19.4k
FRITZ!Box 7560 7.39 /usr/rest_api 10.3k
FRITZ!Box 7583 7.50 - 7.57 /usr/rest_api 10.3k
FRITZ!Box 7590 7.39 - 7.90 /usr/rest_api 10.3k - 19.8k
FRITZ!Box 7590 AX 7.39 - 7.90 /usr/rest_api 10.3k - 19.8k
FRITZ!Box 7690 7.59 /usr/rest_api 10.3k
FRITZ!Repeater 600 7.39 /usr/rest_api 10.3k
FRITZ!Repeater 1200 7.39 /usr/rest_api 10.3k
FRITZ!WLAN Repeater 1750E 7.39 /usr/rest_api 10.3k
FRITZ!Repeater 2400 7.39 /usr/rest_api 10.3k - 16.0k
FRITZ!Repeater 3000 7.39 /usr/rest_api 10.3k
FRITZ!Repeater 3000 AX 7.39 /usr/rest_api 10.3k
FRITZ!Powerline 1260E 7.39 /usr/rest_api 10.3k
50 models use this script

SMW-Browser

Information is currently being retrieved from the backend.
 

Synonyms

Showing 1 related property.

a