{"id":3475,"date":"2022-11-11T13:14:12","date_gmt":"2022-11-11T13:14:12","guid":{"rendered":"https:\/\/serviceobjects.wpaladdin.com\/?page_id=3475"},"modified":"2025-09-27T01:14:49","modified_gmt":"2025-09-27T08:14:49","slug":"ev3-rest","status":"publish","type":"page","link":"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/","title":{"rendered":"EV3 &#8211; REST"},"content":{"rendered":"\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-create-block-tabs\"><ul class=\"tab-labels\" role=\"tablist\" aria-label=\"tabbed content\"><li class=\"tab-label active\" role=\"tab\" aria-selected=\"true\" aria-controls=\"C#\" tabindex=\"0\">C#<\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"Python \" tabindex=\"0\">Python <\/li><li class=\"tab-label\" role=\"tab\" aria-selected=\"false\" aria-controls=\"NodeJS\" tabindex=\"0\">NodeJS<\/li><\/ul><div class=\"tab-content\">\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Email Validation C# Code Snippet<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"Email Validation C# Code Snippet\" data-enlighter-group=\"\">\ufeffusing System.Web;\n\nnamespace email_validation_3_dot_net.REST\n{\n    \/\/\/ &lt;summary>\n    \/\/\/ Provides functionality to call the ServiceObjects Email Validation 3 REST API's ValidateEmailAddress endpoint,\n    \/\/\/ performing email validation with optional correction support and fallback to a backup endpoint in live mode.\n    \/\/\/ &lt;\/summary>\n    public class ValidateEmailAddressClient\n    {\n        \/\/ Base URLs for the Email Validation 3 service.\n        private const string LiveBaseUrl = \"https:\/\/sws.serviceobjects.com\/ev3\/web.svc\/\";\n        private const string BackupBaseUrl = \"https:\/\/swsbackup.serviceobjects.com\/ev3\/web.svc\/\";\n        private const string TrialBaseUrl = \"https:\/\/trial.serviceobjects.com\/ev3\/web.svc\/\";\n\n        \/\/\/ &lt;summary>\n        \/\/\/ Synchronously calls the ValidateEmailAddress REST endpoint to validate an email address,\n        \/\/\/ attempting the primary endpoint first and falling back to the backup if the response is invalid\n        \/\/\/ (Error.TypeCode == \"3\") in live mode.\n        \/\/\/ &lt;\/summary>\n        \/\/\/ &lt;param name=\"input\">The input parameters including email address, license key, and options.&lt;\/param>\n        \/\/\/ &lt;returns>Deserialized &lt;see cref=\"EV3Response\"\/> containing the validation results.&lt;\/returns>\n        public static EV3Response Invoke(ValidationEmailAddressInput input)\n        {\n            \/\/Use query string parameters so missing\/options fields don't break\n            \/\/the URL as path parameters would.\n            string url = BuildUrl(input, input.IsLive ? LiveBaseUrl : TrialBaseUrl);\n            EV3Response response = Helper.HttpGet&lt;EV3Response>(url, input.TimeoutSeconds);\n\n            \/\/ Fallback on error in live mode\n            if (input.IsLive &amp;&amp; !IsValid(response))\n            {\n                string fallbackUrl = BuildUrl(input, BackupBaseUrl);\n                EV3Response fallbackResponse = Helper.HttpGet&lt;EV3Response>(fallbackUrl, input.TimeoutSeconds);\n                return fallbackResponse;\n            }\n\n            return response;\n        }\n\n        \/\/\/ &lt;summary>\n        \/\/\/ Asynchronously calls the ValidateEmailAddress REST endpoint to validate an email address,\n        \/\/\/ attempting the primary endpoint first and falling back to the backup if the response is invalid\n        \/\/\/ (Error.TypeCode == \"3\") in live mode.\n        \/\/\/ &lt;\/summary>\n        \/\/\/ &lt;param name=\"input\">The input parameters including email address, license key, and options.&lt;\/param>\n        \/\/\/ &lt;returns>Deserialized &lt;see cref=\"EV3Response\"\/> containing the validation results.&lt;\/returns>\n        \/\/\/ &lt;exception cref=\"ArgumentException\">Thrown when the email address is missing.&lt;\/exception>\n        public static async Task&lt;EV3Response> InvokeAsync(ValidationEmailAddressInput input)\n        {\n            \/\/Use query string parameters so missing\/options fields don't break\n            \/\/the URL as path parameters would.\n            string url = BuildUrl(input, input.IsLive ? LiveBaseUrl : TrialBaseUrl);\n            EV3Response response = await Helper.HttpGetAsync&lt;EV3Response>(url, input.TimeoutSeconds).ConfigureAwait(false);\n\n            \/\/ Fallback on error in live mode\n            if (input.IsLive &amp;&amp; !IsValid(response))\n            {\n                string fallbackUrl = BuildUrl(input, BackupBaseUrl);\n                EV3Response fallbackResponse = await Helper.HttpGetAsync&lt;EV3Response>(fallbackUrl, input.TimeoutSeconds).ConfigureAwait(false);\n                return fallbackResponse;\n            }\n\n            return response;\n        }\n\n        \/\/ Build the full request URL, including URL-encoded query string\n        public static string BuildUrl(ValidationEmailAddressInput input, string baseUrl)\n        {\n            var qs = $\"JSON\/ValidateEmailAddress?\" +\n                     $\"EmailAddress={HttpUtility.UrlEncode(input.EmailAddress)}\" +\n                     $\"&amp;AllowCorrections={HttpUtility.UrlEncode(input.AllowCorrections)}\" +\n                     $\"&amp;TIMEOUT={HttpUtility.UrlEncode(input.Timeout)}\" +\n                     $\"&amp;LicenseKey={HttpUtility.UrlEncode(input.LicenseKey)}\";\n            return baseUrl + qs;\n        }\n\n        private static bool IsValid(EV3Response response) =>\n            response?.Error == null || response.Error.TypeCode != \"3\";\n\n        \/\/\/ &lt;summary>\n        \/\/\/ Represents the input parameters for the ValidateEmailAddress REST API call.\n        \/\/\/ &lt;\/summary>\n        \/\/\/ &lt;param name=\"EmailAddress\">The email address to validate.&lt;\/param>\n        \/\/\/ &lt;param name=\"LicenseKey\">Your license key to use the service.&lt;\/param>\n        \/\/\/ &lt;param name=\"AllowCorrections\">Whether the service should return a corrected email address if one is found (true\/false).&lt;\/param>\n        \/\/\/ &lt;param name=\"IsLive\">Determines whether to use the live or trial service.&lt;\/param>\n        \/\/\/ &lt;param name=\"TimeoutSeconds\">Timeout, in seconds, for the call to the service.&lt;\/param>\n        public record ValidationEmailAddressInput(\n            string EmailAddress = \"\",\n            string LicenseKey = \"\",\n            string AllowCorrections = \"\",\n            string Timeout = \"\",\n            bool IsLive = true,\n            int TimeoutSeconds = 15\n        );\n    }\n}\n\n\n\ufeffusing System.Runtime.Serialization;\n\nnamespace email_validation_3_dot_net.REST\n{\n    \/\/\/ &lt;summary>\n    \/\/\/ Represents the combined request and response data for performing comprehensive\n    \/\/\/ email address validation using the Email Validation 3 REST API.\n    \/\/\/ &lt;\/summary>\n    [DataContract]\n    public class EV3Response\n    {\n        public string LicenseKey { get; set; }\n        public string EmailAddress { get; set; }\n        public string AllowCorrections { get; set; }\n        public ValidateEmailInfo ValidateEmailInfo { get; set; }\n        public Error Error { get; set; }\n    }\n\n    \/\/\/ &lt;summary>\n    \/\/\/ Represents the detailed results of any email validation operation in the Email Validation 3 REST API.\n    \/\/\/ &lt;\/summary>\n    [DataContract]\n    public class ValidateEmailInfo\n    {\n        public int Score { get; set; }\n        public string IsDeliverable { get; set; }\n        public string EmailAddressIn { get; set; }\n        public string EmailAddressOut { get; set; }\n        public bool EmailCorrected { get; set; }\n        public string Box { get; set; }\n        public string Domain { get; set; }\n        public string TopLevelDomain { get; set; }\n        public string TopLevelDomainDescription { get; set; }\n        public string IsSMTPServerGood { get; set; }\n        public string IsCatchAllDomain { get; set; }\n        public string IsSMTPMailBoxGood { get; set; }\n        public string WarningCodes { get; set; }\n        public string WarningDescriptions { get; set; }\n        public string NotesCodes { get; set; }\n        public string NotesDescriptions { get; set; }\n        public Error Error { get; set; }\n        public override string ToString()\n        {\n            string error = Error != null ? Error.ToString() : \"None\";\n            return $\"ValidateEmailInfo: Score = {Score}, IsDeliverable = {IsDeliverable}, \" +\n                   $\"EmailAddressIn = {EmailAddressIn}, EmailAddressOut = {EmailAddressOut}, \" +\n                   $\"EmailCorrected = {EmailCorrected}, Box = {Box}, Domain = {Domain}, \" +\n                   $\"TopLevelDomain = {TopLevelDomain}, TopLevelDomainDescription = {TopLevelDomainDescription}, \" +\n                   $\"IsSMTPServerGood = {IsSMTPServerGood}, IsCatchAllDomain = {IsCatchAllDomain}, \" +\n                   $\"IsSMTPMailBoxGood = {IsSMTPMailBoxGood}, WarningCodes = {WarningCodes}, \" +\n                   $\"WarningDescriptions = {WarningDescriptions}, NotesCodes = {NotesCodes}, \" +\n                   $\"NotesDescriptions = {NotesDescriptions}, Error = {error}\";\n        }\n    }\n    \/\/\/ &lt;summary>\n    \/\/\/ Represents error information in the Lead Validation International REST API response.\n    \/\/\/ &lt;\/summary>\n    [DataContract]\n    public class Error\n    {\n        public string Type { get; set; }\n        public string TypeCode { get; set; }\n        public string Desc { get; set; }\n        public string DescCode { get; set; }\n\n        public override string ToString()\n        {\n            return $\"Error: Type = {Type}, TypeCode = {TypeCode}, Desc = {Desc}, DescCode = {DescCode}\";\n        }\n    }\n}\n\n\n\ufeffusing System.Text.Json;\nusing System.Web;\n\nnamespace email_validation_3_dot_net.REST\n{\n    public class Helper\n    {\n        public static T HttpGet&lt;T>(string url, int timeoutSeconds)\n        {\n            using var httpClient = new HttpClient\n            {\n                Timeout = TimeSpan.FromSeconds(timeoutSeconds)\n            };\n            using var request = new HttpRequestMessage(HttpMethod.Get, url);\n            using HttpResponseMessage response = httpClient\n                .SendAsync(request)\n                .GetAwaiter()\n                .GetResult();\n            response.EnsureSuccessStatusCode();\n            using Stream responseStream = response.Content\n                .ReadAsStreamAsync()\n                .GetAwaiter()\n                .GetResult();\n            var options = new JsonSerializerOptions\n            {\n                PropertyNameCaseInsensitive = true\n            };\n            object? obj = JsonSerializer.Deserialize(responseStream, typeof(T), options);\n            T result = (T)obj!;\n            return result;\n        }\n\n        \/\/ Asynchronous HTTP GET and JSON deserialize\n        public static async Task&lt;T> HttpGetAsync&lt;T>(string url, int timeoutSeconds)\n        {\n            HttpClient HttpClient = new HttpClient();\n            HttpClient.Timeout = TimeSpan.FromSeconds(timeoutSeconds);\n            using var httpResponse = await HttpClient.GetAsync(url).ConfigureAwait(false);\n            httpResponse.EnsureSuccessStatusCode();\n            var stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);\n            return JsonSerializer.Deserialize&lt;T>(stream)!;\n        }\n\n        public static string UrlEncode(string value) => HttpUtility.UrlEncode(value ?? string.Empty);\n    }\n}<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong><strong><strong><strong>Email Validation 3 Python Code Snippet<\/strong><\/strong><\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import requests  # HTTP client for RESTful API calls\nfrom ev3_response import EV3Response, Error, ValidateEmailInfo\n\n# Endpoint URLs for EV3 ValidateEmailAddress REST API\nprimary_url = \"https:\/\/sws.serviceobjects.com\/ev3\/web.svc\/JSON\/ValidateEmailAddress?\"\nbackup_url = \"https:\/\/swsbackup.serviceobjects.com\/ev3\/web.svc\/JSON\/ValidateEmailAddress?\"\ntrial_url = \"https:\/\/trial.serviceobjects.com\/ev3\/web.svc\/JSON\/ValidateEmailAddress?\"\n\n\ndef validate_email_address(\n    email_address: str,\n    allow_corrections: str,\n    license_key: str,\n    timeout: str,\n    is_live: bool = True,\n    timeout_seconds: int = 15,\n) -> EV3Response:\n    \"\"\"\n    Call EV3 ValidateEmailAddress API to validate an email address.\n\n    Parameters:\n        email_address: Email address to validate.\n        allow_corrections: \"true\" or \"false\" - whether the API can return a corrected email.\n        license_key: Your ServiceObjects license key.\n        timeout: Timeout value (in milliseconds) passed to the API.\n        is_live: Value to determine whether to use the live or trial servers.\n        timeout_seconds: Timeout, in seconds, for the call to the service.\n\n    Returns:\n        EV3Response: Parsed JSON response with validation results or error details.\n    \"\"\"\n\n    params = {\n        \"EmailAddress\": email_address,\n        \"AllowCorrections\": allow_corrections,\n        \"TIMEOUT\": timeout,\n        \"LicenseKey\": license_key,\n    }\n\n    # Select the base URL: production vs trial\n    url = primary_url if is_live else trial_url\n\n    # Attempt primary (or trial) endpoint first\n    try:\n        response = requests.get(url, params=params, timeout=timeout_seconds)\n        response.raise_for_status()\n        data = response.json()\n\n        # If API returned an error in JSON payload, trigger fallback\n        error = getattr(response, 'Error', None)\n        if not (error is None or getattr(error, 'TypeCode', None) != \"3\"):\n            if is_live:\n                # Try backup URL\n                response = requests.get(backup_url, params=params, timeout=timeout_seconds)\n                response.raise_for_status()\n                data = response.json()\n               \n               # If still error, propagate exception\n                if \"Error\" in data:\n                    raise RuntimeError(f\"EV3 service error: {data['Error']}\")\n            else:\n                # Trial mode error is terminal\n                raise RuntimeError(f\"EV3 trial error: {data['Error']}\")\n\n        # Convert JSON response to EV3Response for structured access\n        error = Error(**data.get(\"Error\", {})) if data.get(\"Error\") else None\n        validate_info = (\n            ValidateEmailInfo(**data.get(\"ValidateEmailInfo\", {}))\n            if data.get(\"ValidateEmailInfo\")\n            else None\n        )\n\n        return EV3Response(\n            LicenseKey=data.get(\"LicenseKey\"),\n            EmailAddress=data.get(\"EmailAddress\"),\n            AllowCorrections=data.get(\"AllowCorrections\"),\n            ValidateEmailInfo=validate_info,\n            Error=error,\n        )\n\n    except requests.RequestException as req_exc:\n        # Network or HTTP-level error occurred\n        if is_live:\n            try:\n                # Fallback to backup URL on network failure\n                response = requests.get(backup_url, params=params, timeout=timeout_seconds)\n                response.raise_for_status()\n                data = response.json()\n                if \"Error\" in data:\n                    raise RuntimeError(f\"EV3 backup error: {data['Error']}\") from req_exc\n\n                error = Error(**data.get(\"Error\", {})) if data.get(\"Error\") else None\n                validate_info = (\n                    ValidateEmailInfo(**data.get(\"ValidateEmailInfo\", {}))\n                    if data.get(\"ValidateEmailInfo\")\n                    else None\n                )\n\n                return EV3Response(\n                    LicenseKey=data.get(\"LicenseKey\"),\n                    EmailAddress=data.get(\"EmailAddress\"),\n                    AllowCorrections=data.get(\"AllowCorrections\"),\n                    ValidateEmailInfo=validate_info,\n                    Error=error,\n                )\n            except Exception as backup_exc:\n                raise RuntimeError(\"EV3 service unreachable on both endpoints\") from backup_exc\n        else:\n            raise RuntimeError(f\"EV3 trial error: {str(req_exc)}\") from req_exc\n\n\nfrom dataclasses import dataclass\nfrom typing import Optional\n\n\n@dataclass\nclass Error:\n    Type: Optional[str] = None\n    TypeCode: Optional[str] = None\n    Desc: Optional[str] = None\n    DescCode: Optional[str] = None\n    Number: Optional[str] = None\n\n    def __str__(self) -> str:\n        return (f\"Error: Type={self.Type}, TypeCode={self.TypeCode}, \"\n                f\"Desc={self.Desc}, DescCode={self.DescCode}\")\n\n\n@dataclass\nclass ValidateEmailInfo:\n    Score: Optional[str] = None\n    IsDeliverable: Optional[str] = None\n    EmailAddressIn: Optional[str] = None\n    EmailAddressOut: Optional[str] = None\n    EmailCorrected: Optional[str] = None\n    Box: Optional[str] = None\n    Domain: Optional[str] = None\n    TopLevelDomain: Optional[str] = None\n    TopLevelDomainDescription: Optional[str] = None\n    IsSMTPServerGood: Optional[str] = None\n    IsCatchAllDomain: Optional[str] = None\n    IsSMTPMailBoxGood: Optional[str] = None\n    WarningCodes: Optional[str] = None\n    WarningDescriptions: Optional[str] = None\n    NotesCodes: Optional[str] = None\n    NotesDescriptions: Optional[str] = None\n    Error: Optional['Error'] = None\n\n    def __str__(self) -> str:\n        error = str(self.Error) if self.Error else \"None\"\n        return (f\"ValidateEmailInfo: Score={self.Score}, IsDeliverable={self.IsDeliverable}, \"\n                f\"EmailAddressIn={self.EmailAddressIn}, EmailAddressOut={self.EmailAddressOut}, \"\n                f\"EmailCorrected={self.EmailCorrected}, Box={self.Box}, Domain={self.Domain}, \"\n                f\"TopLevelDomain={self.TopLevelDomain}, TopLevelDomainDescription={self.TopLevelDomainDescription}, \"\n                f\"IsSMTPServerGood={self.IsSMTPServerGood}, IsCatchAllDomain={self.IsCatchAllDomain}, \"\n                f\"IsSMTPMailBoxGood={self.IsSMTPMailBoxGood}, WarningCodes={self.WarningCodes}, \"\n                f\"WarningDescriptions={self.WarningDescriptions}, NotesCodes={self.NotesCodes}, \"\n                f\"NotesDescriptions={self.NotesDescriptions}, Error={error}\")\n\n\n@dataclass\nclass EV3Response:\n    LicenseKey: Optional[str] = None\n    EmailAddress: Optional[str] = None\n    AllowCorrections: Optional[str] = None\n    ValidateEmailInfo: Optional['ValidateEmailInfo'] = None\n    Error: Optional['Error'] = None\n\n    def __str__(self) -> str:\n        validate_email_info = str(self.ValidateEmailInfo) if self.ValidateEmailInfo else \"None\"\n        error = str(self.Error) if self.Error else \"None\"\n        return (f\"EV3Response: LicenseKey={self.LicenseKey}, EmailAddress={self.EmailAddress}, \"\n                f\"AllowCorrections={self.AllowCorrections}, ValidateEmailInfo={validate_email_info}, Error={error}\")<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong><strong><strong><strong>Email Validation 3 NodeJS<\/strong><\/strong><\/strong><\/strong> <strong><strong><strong><strong>Code Snippet<\/strong><\/strong><\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import axios from 'axios';\nimport querystring from 'querystring';\nimport { EV3Response } from '.\/ev3_response.js';\n\n\/**\n * @constant\n * @type {string}\n * @description The base URL for the live ServiceObjects Email Validation 3 API service.\n *\/\nconst LiveBaseUrl = 'https:\/\/sws.serviceobjects.com\/ev3\/web.svc\/';\n\n\/**\n * @constant\n * @type {string}\n * @description The base URL for the backup ServiceObjects Email Validation 3 API service.\n *\/\nconst BackupBaseUrl = 'https:\/\/swsbackup.serviceobjects.com\/ev3\/web.svc\/';\n\n\/**\n * @constant\n * @type {string}\n * @description The base URL for the trial ServiceObjects Email Validation 3 API service.\n *\/\nconst TrialBaseUrl = 'https:\/\/trial.serviceobjects.com\/ev3\/web.svc\/';\n\n\/**\n * &lt;summary>\n * Checks if a response from the API is valid by verifying that it either has no Error object\n * or the Error.Number is not equal to '3'.\n * &lt;\/summary>\n * &lt;param name=\"response\" type=\"Object\">The API response object to validate.&lt;\/param>\n * &lt;returns type=\"boolean\">True if the response is valid, false otherwise.&lt;\/returns>\n *\/\nconst isValid = (response) => !response?.Error || response.Error.TypeCode !== '3';\n\n\/**\n * &lt;summary>\n * Constructs a full URL for the ValidateEmailAddress API endpoint by combining the base URL\n * with query parameters derived from the input parameters.\n * &lt;\/summary>\n * &lt;param name=\"params\" type=\"Object\">An object containing all the input parameters.&lt;\/param>\n * &lt;param name=\"baseUrl\" type=\"string\">The base URL for the API service (live, backup, or trial).&lt;\/param>\n * &lt;returns type=\"string\">The constructed URL with query parameters.&lt;\/returns>\n *\/\nconst buildUrl = (params, baseUrl) =>\n    `${baseUrl}JSON\/ValidateEmailAddress?${querystring.stringify(params)}`;\n\n\/**\n * &lt;summary>\n * Performs an HTTP GET request to the specified URL with a given timeout.\n * &lt;\/summary>\n * &lt;param name=\"url\" type=\"string\">The URL to send the GET request to.&lt;\/param>\n * &lt;param name=\"timeoutSeconds\" type=\"number\">The timeout duration in seconds for the request.&lt;\/param>\n * &lt;returns type=\"Promise&lt;EV3Response>\">A promise that resolves to an EV3Response object containing the API response data.&lt;\/returns>\n * &lt;exception cref=\"Error\">Thrown if the HTTP request fails, with a message detailing the error.&lt;\/exception>\n *\/\nconst httpGet = async (url, timeoutSeconds) => {\n    try {\n        const response = await axios.get(url, { timeout: timeoutSeconds * 1000 });\n        return new EV3Response(response.data);\n    } catch (error) {\n        throw new Error(`HTTP request failed: ${error.message}`);\n    }\n};\n\n\/**\n * &lt;summary>\n * Provides functionality to call the ServiceObjects Email Validation 3 API's ValidateEmailAddress endpoint,\n * performing email validation with optional correction support and fallback to a backup endpoint in live mode.\n * &lt;\/summary>\n *\/\nconst ValidateEmailAddressClient = {\n    \/**\n     * &lt;summary>\n     * Asynchronously invokes the ValidateEmailAddress API endpoint, attempting the primary endpoint\n     * first and falling back to the backup if the response is invalid (Error.TypeCode == '3') in live mode.\n     * &lt;\/summary>\n     * &lt;param name=\"emailAddress\" type=\"string\">The email address to validate.&lt;\/param>\n     * &lt;param name=\"allowCorrections\" type=\"string\">Whether the service should return a corrected email address if one is found (true\/false).&lt;\/param>\n     * &lt;param name=\"licenseKey\" type=\"string\">Your license key to use the service.&lt;\/param>\n     * &lt;param name=\"isLive\" type=\"boolean\">Determines whether to use the live or trial service.&lt;\/param>\n     * &lt;param name=\"timeoutSeconds\" type=\"number\">Timeout, in seconds, for the call to the service.&lt;\/param>\n     * &lt;returns type=\"Promise&lt;EV3Response>\">A promise that resolves to an EV3Response object.&lt;\/returns>\n     *\/\n    async invokeAsync(emailAddress, allowCorrections, licenseKey, isLive, timeout, timeoutSeconds = 15) {\n        const params = {\n            EmailAddress: emailAddress,\n            AllowCorrections: allowCorrections,\n            TIMEOUT: timeout,\n            LicenseKey: licenseKey\n        };\n\n        const url = buildUrl(params, isLive ? LiveBaseUrl : TrialBaseUrl);\n        let response = await httpGet(url, timeoutSeconds);\n\n        if (isLive &amp;&amp; !isValid(response)) {\n            const fallbackUrl = buildUrl(params, BackupBaseUrl);\n            const fallbackResponse = await httpGet(fallbackUrl, timeoutSeconds);\n            return fallbackResponse;\n        }\n\n        return response;\n    },\n\n    \/**\n     * &lt;summary>\n     * Synchronously invokes the ValidateEmailAddress API endpoint by wrapping the async call\n     * and awaiting its result immediately.\n     * &lt;\/summary>\n     * &lt;param name=\"emailAddress\" type=\"string\">The email address to validate.&lt;\/param>\n     * &lt;param name=\"allowCorrections\" type=\"string\">Whether the service should return a corrected email address if one is found (true\/false).&lt;\/param>\n     * &lt;param name=\"licenseKey\" type=\"string\">Your license key to use the service.&lt;\/param>\n     * &lt;param name=\"isLive\" type=\"boolean\">Determines whether to use the live or trial service.&lt;\/param>\n     * &lt;param name=\"timeoutSeconds\" type=\"number\">Timeout, in seconds, for the call to the service.&lt;\/param>\n     * &lt;returns type=\"EV3Response\">An EV3Response object with validation details or an error.&lt;\/returns>\n     *\/\n    invoke(emailAddress, allowCorrections, licenseKey, isLive, timeout, timeoutSeconds = 15) {\n        return (async () => await this.invokeAsync(emailAddress, allowCorrections, licenseKey, isLive, timeout, timeoutSeconds))();\n    }\n};\n\nexport { ValidateEmailAddressClient, EV3Response };\n\n\nexport class ErrorModel {\n    constructor(data = {}) {\n        this.Type = data.Type;\n        this.TypeCode = data.TypeCode;\n        this.Desc = data.Desc;\n        this.DescCode = data.DescCode;\n        this.Number = data.Number;\n    }\n\n    toString() {\n        return `Error: Type = ${this.Type}, TypeCode = ${this.TypeCode}, Desc = ${this.Desc}, DescCode = ${this.DescCode}`;\n    }\n}\n\nexport class ValidateEmailInfo {\n    constructor(data = {}) {\n        this.Score = data.Score;\n        this.IsDeliverable = data.IsDeliverable;\n        this.EmailAddressIn = data.EmailAddressIn;\n        this.EmailAddressOut = data.EmailAddressOut;\n        this.EmailCorrected = data.EmailCorrected;\n        this.Box = data.Box;\n        this.Domain = data.Domain;\n        this.TopLevelDomain = data.TopLevelDomain;\n        this.TopLevelDomainDescription = data.TopLevelDomainDescription;\n        this.IsSMTPServerGood = data.IsSMTPServerGood;\n        this.IsCatchAllDomain = data.IsCatchAllDomain;\n        this.IsSMTPMailBoxGood = data.IsSMTPMailBoxGood;\n        this.WarningCodes = data.WarningCodes;\n        this.WarningDescriptions = data.WarningDescriptions;\n        this.NotesCodes = data.NotesCodes;\n        this.NotesDescriptions = data.NotesDescriptions;\n        this.Error = data.Error ? new Error(data.Error) : null;\n    }\n\n    toString() {\n        const error = this.Error ? this.Error.toString() : \"None\";\n        return `ValidateEmailInfo: Score = ${this.Score}, IsDeliverable = ${this.IsDeliverable}, ` +\n            `EmailAddressIn = ${this.EmailAddressIn}, EmailAddressOut = ${this.EmailAddressOut}, ` +\n            `EmailCorrected = ${this.EmailCorrected}, Box = ${this.Box}, Domain = ${this.Domain}, ` +\n            `TopLevelDomain = ${this.TopLevelDomain}, TopLevelDomainDescription = ${this.TopLevelDomainDescription}, ` +\n            `IsSMTPServerGood = ${this.IsSMTPServerGood}, IsCatchAllDomain = ${this.IsCatchAllDomain}, ` +\n            `IsSMTPMailBoxGood = ${this.IsSMTPMailBoxGood}, WarningCodes = ${this.WarningCodes}, ` +\n            `WarningDescriptions = ${this.WarningDescriptions}, NotesCodes = ${this.NotesCodes}, ` +\n            `NotesDescriptions = ${this.NotesDescriptions}, Error = ${error}`;\n    }\n}\n\nexport class EV3Response {\n    constructor(data = {}) {\n        this.LicenseKey = data.LicenseKey;\n        this.EmailAddress = data.EmailAddress;\n        this.AllowCorrections = data.AllowCorrections;\n        this.ValidateEmailInfo = data.ValidateEmailInfo ? new ValidateEmailInfo(data.ValidateEmailInfo) : null;\n        this.Error = data.Error ? new Error(data.Error) : null;\n    }\n\n    toString() {\n        const validateEmailInfo = this.ValidateEmailInfo ? this.ValidateEmailInfo.toString() : \"None\";\n        const error = this.Error ? this.Error.toString() : \"None\";\n        return `EV3Response: LicenseKey = ${this.LicenseKey}, EmailAddress = ${this.EmailAddress}, ` +\n            `AllowCorrections = ${this.AllowCorrections}, ValidateEmailInfo = ${validateEmailInfo}, Error = ${error}`;\n    }\n}\n\nexport default EV3Response;<\/pre>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"parent":3228,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3475","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>EV3 - REST<\/title>\n<meta name=\"description\" content=\"C#Python NodeJS Email Validation C# Code Snippet \ufeffusing System.Web; namespace email_validation_3_dot_net.REST { \/\/\/ &lt;summary&gt; \/\/\/ Provides\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"EV3 - REST\" \/>\n<meta property=\"og:description\" content=\"C#Python NodeJS Email Validation C# Code Snippet \ufeffusing System.Web; namespace email_validation_3_dot_net.REST { \/\/\/ &lt;summary&gt; \/\/\/ Provides\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/\" \/>\n<meta property=\"og:site_name\" content=\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-27T08:14:49+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/\",\"url\":\"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/\",\"name\":\"EV3 - REST\",\"isPartOf\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#website\"},\"datePublished\":\"2022-11-11T13:14:12+00:00\",\"dateModified\":\"2025-09-27T08:14:49+00:00\",\"description\":\"C#Python NodeJS Email Validation C# Code Snippet \ufeffusing System.Web; namespace email_validation_3_dot_net.REST { \/\/\/ &lt;summary> \/\/\/ Provides\",\"breadcrumb\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.serviceobjects.com\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DOTS Email Validation 3\",\"item\":\"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"EV3 &#8211; Code Snippets and Sample Code\",\"item\":\"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"EV3 &#8211; REST\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#website\",\"url\":\"https:\/\/www.serviceobjects.com\/docs\/\",\"name\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.serviceobjects.com\/docs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#organization\",\"name\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\",\"url\":\"https:\/\/www.serviceobjects.com\/docs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png\",\"contentUrl\":\"https:\/\/www.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png\",\"width\":2560,\"height\":1440,\"caption\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\"},\"image\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"EV3 - REST","description":"C#Python NodeJS Email Validation C# Code Snippet \ufeffusing System.Web; namespace email_validation_3_dot_net.REST { \/\/\/ &lt;summary> \/\/\/ Provides","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/","og_locale":"en_US","og_type":"article","og_title":"EV3 - REST","og_description":"C#Python NodeJS Email Validation C# Code Snippet \ufeffusing System.Web; namespace email_validation_3_dot_net.REST { \/\/\/ &lt;summary> \/\/\/ Provides","og_url":"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/","og_site_name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","article_modified_time":"2025-09-27T08:14:49+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/","url":"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/","name":"EV3 - REST","isPartOf":{"@id":"https:\/\/www.serviceobjects.com\/docs\/#website"},"datePublished":"2022-11-11T13:14:12+00:00","dateModified":"2025-09-27T08:14:49+00:00","description":"C#Python NodeJS Email Validation C# Code Snippet \ufeffusing System.Web; namespace email_validation_3_dot_net.REST { \/\/\/ &lt;summary> \/\/\/ Provides","breadcrumb":{"@id":"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/ev3-rest\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.serviceobjects.com\/docs\/"},{"@type":"ListItem","position":2,"name":"DOTS Email Validation 3","item":"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/"},{"@type":"ListItem","position":3,"name":"EV3 &#8211; Code Snippets and Sample Code","item":"https:\/\/www.serviceobjects.com\/docs\/dots-email-validation-3\/ev3-code-snippets-and-sample-code\/"},{"@type":"ListItem","position":4,"name":"EV3 &#8211; REST"}]},{"@type":"WebSite","@id":"https:\/\/www.serviceobjects.com\/docs\/#website","url":"https:\/\/www.serviceobjects.com\/docs\/","name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","description":"","publisher":{"@id":"https:\/\/www.serviceobjects.com\/docs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.serviceobjects.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.serviceobjects.com\/docs\/#organization","name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","url":"https:\/\/www.serviceobjects.com\/docs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.serviceobjects.com\/docs\/#\/schema\/logo\/image\/","url":"https:\/\/www.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png","contentUrl":"https:\/\/www.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png","width":2560,"height":1440,"caption":"Service Objects | Contact, Phone, Email Verification | Data Quality Services"},"image":{"@id":"https:\/\/www.serviceobjects.com\/docs\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/3475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/comments?post=3475"}],"version-history":[{"count":15,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/3475\/revisions"}],"predecessor-version":[{"id":12358,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/3475\/revisions\/12358"}],"up":[{"embeddable":true,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/3228"}],"wp:attachment":[{"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/media?parent=3475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}