api_call function

Helper function for centralize API queries