Fix a NPE when fetching the root document on the REST side.
Refactor the (correctly documented) service interface involved.