This is a followup for rECTR680cdd688ae1: Use an API module instead of the old (to be removed) ajax functions, one of those "quick conversions from ajax to an API module" that resulted in an 'internal' API module full of technical debt.
- The extension's API module currently returns an HTML blob wrapped in the selected API output format. It should instead output the tree data in a structured form for the client to turn into HTML or whatever.
- The horrible options JSON blob parameter should be turned into actual documented parameters.