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:phonebook.lua (restapi)

From BoxMatrix


BoxMatrix >> Webinterface >> phonebook.lua (restapi) @ 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 REST-API Lua-Scripts Javascript Browser SSI-Files SSI-Directives HTML-Text Event-Text Help-Pages CSS-Files Graphics Research

Info
  
Name-Collision - multiple objects in this wiki use the name phonebook.lua!
phonebook.lua (luascr) TODO
phonebook.lua (restapi) REST-API Plugin for the Phonebook

RESTAPI-Script

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

Details

phonebook.lua is the REST-API Plugin for the Phonebook. It is the successor of the phonebook_rest.lua module.

It is auto-included by api.lua, like all /usr/rest_api/plugins/*.lua scripts, and supports:

GET    /api/v0/phonebook/books                          # get a list of phone book details
PUT    /api/v0/phonebook/books                          # create a single phone book

GET    /api/v0/phonebook/books/<book>                   # get details of a single phone book
PUT    /api/v0/phonebook/books/<book>                   # change name of a single phone book
DELETE /api/v0/phonebook/books/<book>                   # delete a single phone book

GET    /api/v0/phonebook/books/<book>/entries           # get all entries of a single phone book
POST   /api/v0/phonebook/books/<book>/entries           # create a single entry of a phone book

GET    /api/v0/phonebook/books/<book>/entries/<entry>   # get a single entry of a phone book 
PUT    /api/v0/phonebook/books/<book>/entries/<entry>   # write a single entry of a phone book
DELETE /api/v0/phonebook/books/<book>/entries/<entry>   # delete a single entry of a phone book

POST   /api/v0/phonebook/books/<book>/entries/<entry>/numbers # add numbers to a phone book entry
POST   /api/v0/phonebook/books/<book>/entries/<entry>/emails  # add emails to a phone book entry

PUT    /api/v0/phonebook/books/<book>/entries/<entry>/numbers/<number> # edit a single number
PUT    /api/v0/phonebook/books/<book>/entries/<entry>/emails/<email>   # edit a single email

DELETE /api/v0/phonebook/books/<book>/entries/<entry>/numbers/<number> # delete a single number
DELETE /api/v0/phonebook/books/<book>/entries/<entry>/emails/<email>   # delete a single email

POST   /api/v0/phonebook/books/<book>/copy              # copy a phone book
POST   /api/v0/phonebook/books/<book>/move              # move a phone book
POST   /api/v0/phonebook/books/<book>/delete            # delete a phone book

GET    /api/v0/phonebook/configuration                  # get global phone book configuration
PUT    /api/v0/phonebook/configuration                  # write global phone book configuration

<book>, <entry>, <number> and <email> are UIDs of the respective item.

REST-API:

Functions

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

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

# Recursive function that maps lua lib values to spec conform REST API values and in reverse
local function mapper(direction, key, bookUid, elem, arrayCounter)

# Validates the request body and sends an error, if the body is not valid
local function validateBody(body)

# 
local function getUidNotFoundError(paramName)

# Validates UIDs from the path parameter
local function validatedUid(uid, paramName)

# Validates an entry number
local function validateNumber(request, bookUid, number)

# Validates entry email
local function validateEmail(request, email)

# Validates entry parameters without numbers nor emails
local function validateEntryParams(request, body)

# Validates an entry
local function validateEntry(request, body, bookUid)

# Validates a phonebook name
local function validatePhonebookName(request, body)

# Transforms lua lib error to REST API error and sends an error response
local function sendError(err, fieldPath)

# Handler function to get a list of phone book details
local function getBooks()

# Handler function to get details of a single phone book
local function getBook(request, params)

# Handler function to validate the body and create a single phone book
local function createBook(request, _, body)

# Checks if a phonebook with given UID exists
local function bookExists(bookUid)

# Handler function to change name of a single phone book
local function renameBook(request, params, body)

# Handler function to delete a single phone book
local function deleteBook(request, params)

# Handler function to get all entries of a single phone book
local function getEntries(request, params)

# Handler function to send a single entry of a phone book to the client
local function getEntry(request, params)

# Handler function to create a single entry of a phone book
local function createEntry(request, params, body)

# Handler function to write a single entry of a phone book
local function editEntry(request, params, body)

# Handler function to delete a single entry of a phone book
local function deleteEntry(request, params)

# Handler function to add numbers or emails to a single phone book entry
local function addNumbersOrEmails(which, request, params, body)

# find a specific number or email of a single phone book entry
local function findNumberOrEmail(which, entryData, elementUid)

# Handler function to edit a specific number or email of a single phone book entry
local function editNumberOrEmail(which, request, params, body)

# Handler function to delete a specific number or email from a single phone book entry
local function deleteNumberOrEmail(which, request, params)

# Handler function to perform a selected function across multiple entries of a book
local function bulkEditEntries(request, params, body)

# Handler function to send general phonebooks configuration
local function getConfiguration()

# Helper function to validate the configuration
local function validateConfiguration(request, body)

# Handler function to validate and save general phonebooks configuration
local function editConfiguration(request, _, body)

# Match the params of plugin.(get/put/post/delete)-data to path-handlers
local function matchPath(method, request)

# Handles any request
local function handle(method, params, body)

# handles all GET-requests of the plugin
function plugin.get_data(params)

# handles all PUT-requests of the plugin
function plugin.put_data(params)

# handles all POST-requests of the plugin
function plugin.post_data(params)

# handles all DELETE-requests of the plugin
function plugin.delete_data(params) 

Dependencies

Daily updated index of all dependencies of this script. Last update: 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
Accesses uimod ontel (uimod) 16 4.80 - 5.04 Online-Phonebook AVM
Accesses uimod telcfg 51 4.80 - 8.00 Telephony configuration AVM
Accesses uimod tr064 83 4.80 - 8.00 TR-064 settings AVM
Requires rest array.lua 25 7.90 - 8.00 REST-API common collection of array-functions AVM
Requires rest common.lua (restapi) 25 7.90 - 8.00 REST-API common helper functions AVM
Requires rest func.lua 25 7.90 - 8.00 REST-API common collection of higher order functions AVM
Requires rest response.lua 25 7.90 - 8.00 REST-API Response API AVM
Requires rest rest_api_const.lua 25 7.90 - 8.00 REST-API Const Tables AVM
Requires rest saveset.lua 25 7.90 - 8.00 TODO AVM
Requires rest table.lua 25 7.90 - 8.00 REST-API common extension of the Lua table module AVM
Requires rest uimod.lua (restapi) 25 7.90 - 8.00 REST-API UI-Modules API AVM
Requires rest validcheck.lua 25 7.90 - 8.00 REST-API common validation helper functions AVM
12 dependencies for this script

Model-Matrix

Daily updated index of the presence, path and size of this script for each model. Last update: 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/rtl) label in the Model column shows which CPU is meant for Multi-Linux models.
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 4040 7.90 - 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 4050 7.90 /usr/rest_api/plugins 28.7k
FRITZ!Box 4060 7.90 /usr/rest_api/plugins 28.7k
FRITZ!Box 5530 Fiber (main) 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 5590 Fiber (main) 7.90 - 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 5590 Fiber (prx) 7.90 - 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 6591 Cable (arm) 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 6591 Cable (atom) 7.90 - 8.00 /usr/rest_api/plugins 28.7k - 28.8k
FRITZ!Box 6660 Cable (arm) 7.90 - 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 6660 Cable (atom) 7.90 - 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 6670 Cable (arm) 7.90 /usr/rest_api/plugins 28.7k
FRITZ!Box 6670 Cable (atom) 7.90 /usr/rest_api/plugins 28.7k
FRITZ!Box 6690 Cable (arm) 7.90 /usr/rest_api/plugins 28.7k
FRITZ!Box 6690 Cable (atom) 7.90 /usr/rest_api/plugins 28.7k
FRITZ!Box 6850 LTE 7.90 /usr/rest_api/plugins 28.7k
FRITZ!Box 6850 5G 7.90 /usr/rest_api/plugins 28.7k
FRITZ!Box 7510 7.90 - 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 7520 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 7520 v2 (main) 7.90 - 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 7530 7.90 - 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 7530 AX 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 7583 VDSL (main) 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 7590 (main) 7.90 - 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 7590 AX (main) 8.00 /usr/rest_api/plugins 28.7k
FRITZ!Box 7690 7.90 /usr/rest_api/plugins 28.7k
25 models use this script

SMW-Browser

Information is currently being retrieved from the backend.