refactor REST calls