add REST documentation for ui module

There was an opportunity for reducing code repetition here by making functions that are shared by the different routers. I'll follow up.