All endpoints are on triple-list.php. Pass the active knowledge base with kb=<slug> (and session as required). Responses are JSON.
Flag preview
Resolves a flag image URL for language/locale cell l (editor preview).
GET triple-list.php?kb=my-kb&triple_list_flag_preview=1&l=en
// Example response
{"src":"…/flags/…svg"}
Enum lookup
Editor support for enumerated values (requires admin session and valid KB). Query parameters: triple_enum_lookup=1, attr, optional editor_l.
GET triple-list.php?kb=my-kb&triple_enum_lookup=1&attr=…&editor_l=…
// Error / empty
{"ok":false,"message":"Nicht berechtigt"}
Predicate lookup
Returns predicate suggestions from the ontology for the triple editor (requires admin session).
GET triple-list.php?kb=my-kb&triple_p_lookup=1
// Shape (simplified)
{"ok":true,"values":[…]}
rule-evaluate.php (primary JSON API)
Method: POST only. Body: JSON. Evaluates a rule’s if_condition and processes then_action / else_action branches, returns prompts (ask, value), missing variables, or sync_all_if / admin actions.
POST rule-evaluate.php
Content-Type: application/json
{
"kb": "my-kb",
"rule_id": 42,
"variables": { "pages": "12", "SomeRule": "TRUE" },
"ui_lang": "en"
}
// Alternative: select by name
{ "kb": "my-kb", "rule_name": "My rule", "variables": {} }
Jacobi-style IF sync over all rules in the KB (client sends current variables):
{ "kb": "my-kb", "action": "sync_all_if", "variables": { … } }
Admin-only maintenance (recompute IF use counts):
{ "kb": "my-kb", "action": "recompute_use_counts" }
then_action / else_action — supported constructs
Action text is line-oriented (separated by newlines or ;). The engine recognises the following. Anything else on a line is currently ignored by the line processor (there is no send_mail() or similar in the codebase today).
set(varName, value) — assigns a variable. value may be a quoted string with $otherVar$ placeholders, a variable name, a number, or a numeric expression using variable names (e.g. counter+1).
age(argument) — argument is a date string (Y-m-d) or a variable holding such a date. Sets age_valid (TRUE/FALSE), age_years, age_months, age_days.
http_status(url) — resolves url (literal or variable), performs an HTTP HEAD request, sets http_status (numeric code or empty), http_status_type, and http_status_description.
ask(…) — handled by the evaluator (interactive prompts, optional scale / assign variable). Not executed as a simple assignment line.
value("…") — first value("…") in the chosen branch supplies free-text capture (ask_value flow in JSON).
set(score, counter+1);
age($birthdate$);
http_status("https://example.com/api/health");
deriver.php JSON helpers
These use query parameters on deriver.php (same KB context as the Deriver page).
Search rules (GET, JSON):
GET deriver.php?kb=my-kb&action=search_rules&q=invoice
// { "ok": true, "rules": [ { "id": "1", "name": "…" }, … ] }
Save Deriver session (POST, JSON body, admin):
POST deriver.php?kb=my-kb&action=deriver_save_session
{ "session_json": "{…}" }
Load last saved session (GET, admin):
GET deriver.php?kb=my-kb&action=deriver_load_last_session
// { "ok": true, "session_json": "…" } or null