moving method to api request