Added exception handling to API service calls.