Feature/rest api refactoring