[REST] Post-Merge overhaul of the REST API

I know, but this one is unavoidable, and not just some cosmetic change.