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 generic.lua

From BoxMatrix


BoxMatrix >> Webinterface >> api_generic.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_generic.lua provides the REST-API Generic Endpoints. It is included by api.lua.

It creates endpoints from UI-Modules whitelisted by uimod.lua and their webvariables filtered by api_generic_filter.lua.
It provides these request methods to perform actions similar to ctlmgr_ctl:

GET    /api/v0/<uimod>                      # list a complete uimod
GET    /api/v0/<uimod>/<string>             # get a single webvar value or a list
GET    /api/v0/<uimod>/<string>/<string>    # get a single webvar value or a list

PUT    /api/v0/<uimod>                      # write request body values to uimod/webvar
PUT    /api/v0/<uimod>/<string>             # write request body values to existing list item

POST   /api/v0/<uimod>/<string>             # create new list item from request body values 

DELETE /api/v0/<uimod>/<string>/<string>    # delete an existing list item by its uid

The whitelisting of uimod.lua is mandatory. Modules not listed there are not accessible.
The whitelisting of api_generic_filter.lua is enabled by default, but could be switched off,
but this will also disable any knowledge about the data types used by whitelisted webvars.

In this so far unused case a generic data model is assumed, which may not work for some modules.
This corner will likely evolve, and the webvar data type knowledge may turn a database with time.

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_generic.lua

local function check_empty_body()

# Get all allowed modules from Uimod which are represented as endpoints
function api_generic.get_endpoints()

# Write the given request body values to the ui-module/webvariables and send their results 
# to the client - PUT /api/v0/<string>.
function api_generic.set_module(params)

# Get a single webvariable value, a list or a complete UI module and send it to the client.
# GET /api/v0/<string> - GET /api/v0/<string>/<string> - GET /api/v0/<string>/<string>/<string>
function api_generic.get_data(params)

# Create a new list item and set its values given in the requests body.
# POST /api/v0/<string>/<string>
function api_generic.create_list_item(params)

# Write values of an existing list item given in the requests body.
# PUT /api/v0/<string>/<string>
function api_generic.set_list_item(params)

# Delete an existing list item by its uid.
# DELETE /api/v0/<string>/<string>/<string>
function api_generic.delete_list_item(params) 

Dependencies

Daily updated index of all dependencies of this script. Last update: 2024-04-25 08:41 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 libavmluautils.so 50 7.39 - 7.90 Utility Lua-Library AVM
Requires lua api_generic_filter.lua 50 7.39 - 7.90 REST-API UI-Modules Webvar Filter AVM
Requires lua avmluamessages.lua 49 7.39 - 7.62 REST-API Debug Message Printer 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 uimod.lua 50 7.39 - 7.90 REST-API UI-Modules API AVM
Required by lua api.lua 50 7.39 - 7.90 REST-API Lua-Land root for scgi_server AVM
Includes js box.js 50 7.39 - 7.90 TODO AVM
8 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-25 06:20 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 8.4k
FRITZ!Box 4040 7.39 - 7.57 /usr/rest_api 8.4k
FRITZ!Box 4050 7.57 /usr/rest_api 8.4k
FRITZ!Box 4060 7.39 - 7.57 /usr/rest_api 8.4k
FRITZ!Box 5530 Fiber (main) 7.39 - 7.80 /usr/rest_api 7.7k - 8.4k
FRITZ!Box 5590 Fiber (arm) 7.39 - 7.90 /usr/rest_api 7.4k - 8.4k
FRITZ!Box 5590 Fiber (prx) 7.70 - 7.90 /usr/rest_api 7.4k - 7.7k
FRITZ!Box 5690 Pro (arm) 7.59 - 7.60 /usr/rest_api 8.4k
FRITZ!Box 6430 Cable (arm) 7.57 /usr/rest_api 8.4k
FRITZ!Box 6490 Cable (arm) 7.39 - 7.57 /usr/rest_api 8.4k
FRITZ!Box 6490 Cable (atom) 7.39 - 7.51 /usr/rest_api 8.4k
FRITZ!Box 6590 Cable (arm) 7.39 - 7.57 /usr/rest_api 8.4k
FRITZ!Box 6590 Cable (atom) 7.39 - 7.51 /usr/rest_api 8.4k
FRITZ!Box 6591 Cable (arm) 7.39 - 7.90 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 6591 Cable (atom) 7.39 - 7.90 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 6660 Cable (arm) 7.39 - 7.90 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 6660 Cable (atom) 7.39 - 7.90 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 6670 Cable (arm) 7.57 - 7.62 /usr/rest_api 8.4k
FRITZ!Box 6670 Cable (atom) 7.61 - 7.62 /usr/rest_api 8.4k
FRITZ!Box 6690 Cable (arm) 7.39 - 7.90 /usr/rest_api 7.9k - 8.4k
FRITZ!Box 6690 Cable (atom) 7.39 - 7.90 /usr/rest_api 7.9k - 8.4k
FRITZ!Box 6820 LTE v1 7.39 - 7.51 /usr/rest_api 8.4k
FRITZ!Box 6820 LTE v2 7.39 - 7.51 /usr/rest_api 8.4k
FRITZ!Box 6820 LTE v3 7.39 - 7.57 /usr/rest_api 8.4k
FRITZ!Box 6840 LTE 7.39 /usr/rest_api 8.4k
FRITZ!Box 6850 LTE 7.39 - 7.90 /usr/rest_api 7.4k - 8.4k
FRITZ!Box 6850 5G 7.39 - 7.90 /usr/rest_api 7.4k - 8.4k
FRITZ!Box 6890 LTE 7.39 - 7.51 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 6890 LTE v1 7.39 - 7.51 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 6890 LTE v2 7.39 - 7.51 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 7272 7.39 /usr/rest_api 8.4k
FRITZ!Box 7430 7.39 /usr/rest_api 8.4k
FRITZ!Box 7490 (main) 7.39 - 7.57 /usr/rest_api 8.4k
FRITZ!Box 7510 7.39 - 7.57 /usr/rest_api 8.4k
FRITZ!Box 7520 7.39 - 7.51 /usr/rest_api 8.4k
FRITZ!Box 7520 v2 (arm) 7.39 - 7.57 /usr/rest_api 8.4k
FRITZ!Box 7530 7.39 - 7.56 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 7530 AX 7.39 - 7.90 /usr/rest_api 7.4k - 8.4k
FRITZ!Box 7560 7.39 /usr/rest_api 8.4k
FRITZ!Box 7583 7.50 - 7.57 /usr/rest_api 8.4k
FRITZ!Box 7590 7.39 - 7.90 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 7590 AX 7.39 - 7.90 /usr/rest_api 5.3k - 8.4k
FRITZ!Box 7690 7.59 /usr/rest_api 8.4k
FRITZ!Repeater 600 7.39 /usr/rest_api 8.4k
FRITZ!Repeater 1200 7.39 /usr/rest_api 8.4k
FRITZ!WLAN Repeater 1750E 7.39 /usr/rest_api 8.4k
FRITZ!Repeater 2400 7.39 /usr/rest_api 5.3k - 8.4k
FRITZ!Repeater 3000 7.39 /usr/rest_api 8.4k
FRITZ!Repeater 3000 AX 7.39 /usr/rest_api 8.4k
FRITZ!Powerline 1260E 7.39 /usr/rest_api 8.4k
50 models use this script

SMW-Browser

Information is currently being retrieved from the backend.
 

Synonyms

Showing 1 related property.

a