refactor REST API invoker