Added error triggering on API calls.

Added error triggering on curl errors and missing response.