database populated from API call with error handling