Added code to call api and convert response to an array