RestAPI refactoring