added a method to send and receive from API