Improved Web request error response and API implementation