Resource icon

Beta Admin API: read-only operational endpoints 1.0.0 beta 1

No permission to download
Compatible XF 2.x versions
  1. 2.2
  2. 2.3
Additional requirements
PHP v7.4+
License
MIT
Visible branding
No
XenForo's REST API is a content API: it reads and writes threads, posts and members. It cannot tell a monitoring script whether anything is in the error log, which add-ons are installed at which version, whether cron is running, or how the forum is configured.

This add-on adds read-only endpoints for exactly that, so that a monitoring system, a dashboard or an agent can ask about a forum's operational state without being given the admin control panel. No endpoint changes the forum: the only thing any of them writes is a line in the admin log for each member lookup.

What it reports​

  • Error log summary: errors grouped by signature, with counts, the add-on each comes from, whether it came from a web request, a job or the command line, and how many members were affected. Never the message, the trace, or who was behind it.
  • Logs: counts from every log XenForo keeps, including the IP, login attempt and upgrade logs the control panel has no page for.
  • Add-ons: every add-on and its version, whether its files match, and any upgrade left pending.
  • Add-on checks: whether an add-on's own validate checks pass, for add-ons that declare them.
  • Cron entries and the job queue: overdue entries, stalled and failed jobs.
  • Who is online, the approval queue, reports, registrations and content by state, and user upgrades: counts.
  • Options and config.php: which settings are set, or their values with every secret withheld, behind a scope of its own.

Member data, behind gates of its own​

Troubleshooting sometimes needs a member: which other accounts have used this IP address, who the moderators and administrators are, which upgrades a member holds. Those endpoints each need a scope of their own and XenForo's own admin permission for the same thing, so the API is never a way round the control panel. Every member lookup is written to the admin log.

Access​

  • A user API key only. Super user keys and OAuth tokens are refused.
  • Each capability is a scope ticked on the key. A key set to "all scopes" is refused, so that one radio button cannot hand over member data or the values of settings.
  • The key's user needs the Use the Admin API admin permission.

For other add-on developers​

Two code events let an add-on take part: hampel_admin_api_redaction declares which of its options and config.php keys are secrets, so that the rest of its settings can be shown; hampel_admin_api_validate declares its own checks, so that they can be run over the API. The README has the details.

Command line​

admin-api:config shows how the add-on is set up and which keys can use it; admin-api:validate proves it works. admin-api:fault-* plant real faults on a test forum, so that there is something for every endpoint to report. They refuse to run unless the forum's config.php enables them.

Requirements​

  • XenForo 2.2.0 or later (a few fields XenForo 2.2 does not record are reported as absent)
  • PHP 7.4 or later
  • The REST API enabled

Status​

This is a beta. It has run on several production forums, polled every few minutes by monitoring, without a defect, but the endpoints may still change before 1.0.0. The full documentation, with every endpoint and field, is in the README in the download.
Author
Sim
Downloads
0
Views
4
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from Sim

Back
Top Bottom