getAPI function

Get the data from API