Updated some REST documentation (#9013)

This commit is contained in:
GabrieleDeri 2025-03-03 10:31:37 +01:00 committed by GitHub
parent d884c9bc14
commit 4c1026f54d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 28 additions and 19 deletions

View file

@ -1,5 +1,5 @@
--
-- (C) 2019-24 - ntop.org
-- (C) 2019-25 - ntop.org
--
local dirs = ntop.getDirs()
@ -8,18 +8,19 @@ package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
local json = require("dkjson")
local syslog_utils = require "syslog_utils"
sendHTTPContentTypeHeader('application/json')
local rest_utils = require("rest_utils")
local res = {}
local ifid = interface.getId()
if tonumber(_GET["ifid"]) ~= nil then
ifid = _GET["ifid"]
local ifid = tonumber(_GET["ifid"])
local rc = rest_utils.consts.success.ok
if ifid == nil then
rest_utils.answer(rest_utils.consts.err.missing_parameters, {"Interface id (ifid) required"})
end
if ifid ~= nil then
res = syslog_utils.getProducers(ifid)
end
print(json.encode(res))
tprint(res)
rest_utils.answer(rc, res)