How would you integrate external APIs into a data application while handling errors and malformed responses?