integrated the api call and tested the same