Initial REST API refactoring.