[WIP] continue to clean-up the API

Although there are many changes in the patch, the external API didn't
change much. But this is needed to have a cleaner higher-level REST
interface, and it add fews key missing merge functions for common
constructs.