Refactor api request execution