Refactored api call into ApiRequest class