Implemented function for sending api request