updating the code for hitting the api and getting the details return by the api