Added new feature that the API sets an HTTP status code if the query returned an error