refactor REST APIs