callAPI function

Make an API request