add /templates endpoint and include types+templates+conditions+chains in dump output

This commit is contained in:
John
2023-10-22 12:17:43 +02:00
parent b752062d5c
commit b901232678
9 changed files with 311 additions and 22 deletions
+12
View File
@@ -2254,6 +2254,18 @@ result_t MainLoop::executeGet(const vector<string>& args, bool* connected, ostri
return formatHttpResult(ret, type, ostream);
}
if (uri == "/templates" || uri.substr(0, 11) == "/templates/") {
*ostream << "[";
OutputFormat verbosity = OF_NAMES|OF_JSON|OF_ALL_ATTRS;
string name = uri == "/templates" ? "" : uri.substr(11) + "/";
const auto tmpl = m_scanHelper->getTemplates(name);
tmpl->dump(verbosity, ostream);
*ostream << "\n]";
type = 6;
*connected = false;
return formatHttpResult(ret, type, ostream);
}
if (uri == "/raw") {
time_t since = 0, until = 0;
bool onlyUnknown = false;