{"id":1820,"date":"2022-11-08T00:12:02","date_gmt":"2022-11-08T00:12:02","guid":{"rendered":"https:\/\/serviceobjects.wpaladdin.com\/?post_type=serviceobjects&#038;p=1820"},"modified":"2025-10-08T10:46:31","modified_gmt":"2025-10-08T17:46:31","slug":"agi-rest","status":"publish","type":"page","link":"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/","title":{"rendered":"AGI &#8211; REST"},"content":{"rendered":"\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>Address Geocode &#8211; International 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=\"true\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\ufeffusing System.Threading.Tasks;\n\nnamespace address_geocode_international_dot_net.REST\n{\n    \/\/\/ &lt;summary>\n    \/\/\/ Client for PlaceSearch operation via ServiceObjects AGI REST API.\n    \/\/\/ Supports fallback to backup URL if live service fails.\n    \/\/\/ &lt;\/summary>\n    public static class PlaceSearchClient\n    {\n        \/\/ Base URL constants: production, backup, and trial\n        private const string LiveBaseUrl = \"https:\/\/sws.serviceobjects.com\/AGI\/api.svc\/json\/PlaceSearch\";\n        private const string BackupBaseUrl = \"https:\/\/swsbackup.serviceobjects.com\/AGI\/api.svc\/json\/PlaceSearch\";\n        private const string TrialBaseUrl = \"https:\/\/trial.serviceobjects.com\/AGI\/api.svc\/json\/PlaceSearch\";\n\n        \/\/\/ &lt;summary>\n        \/\/\/ Synchronously call the PlaceSearchJson endpoint.\n        \/\/\/ &lt;\/summary>\n        \/\/\/ &lt;param name=\"input\">Request parameters (address, license key, isLive).&lt;\/param>\n        \/\/\/ &lt;returns>Deserialized &lt;see cref=\"AGIPlaceSearchResponse\"\/>.&lt;\/returns>\n        public static AGIPlaceSearchResponse Invoke(PlaceSearchInput input)\n        {\n            \/\/ Use appropriate base URL depending on live\/trial flag\n            var url = BuildUrl(input, input.IsLive ? LiveBaseUrl : TrialBaseUrl);\n\n            \/\/Use query string parameters so missing\/options fields don't break\n            \/\/the URL as path parameters would.\n            AGIPlaceSearchResponse response = Helper.HttpGet&lt;AGIPlaceSearchResponse>(url, input.TimeoutSeconds);\n\n            \/\/ Fallback on error payload in live mode\n            if (input.IsLive &amp;&amp; !IsValid(response))\n            {\n                var fallbackUrl = BuildUrl(input, BackupBaseUrl);\n                AGIPlaceSearchResponse fallbackResponse = Helper.HttpGet&lt;AGIPlaceSearchResponse>(fallbackUrl, input.TimeoutSeconds);\n                return fallbackResponse;\n            }\n\n            return response;\n        }\n\n        \/\/\/ &lt;summary>\n        \/\/\/ Asynchronously call the PlaceSearchJson endpoint.\n        \/\/\/ &lt;\/summary>\n        \/\/\/ &lt;param name=\"input\">Request parameters (address, license key, isLive).&lt;\/param>\n        \/\/\/ &lt;returns>Deserialized &lt;see cref=\"AGIPlaceSearchResponse\"\/>.&lt;\/returns>\n        public static async Task&lt;AGIPlaceSearchResponse> InvokeAsync(PlaceSearchInput input)\n        {\n            \/\/ Use appropriate base URL depending on live\/trial flag\n            var url = BuildUrl(input, input.IsLive ? LiveBaseUrl : TrialBaseUrl);\n\n            \/\/ Perform HTTP GET request asynchronously and deserialize response\n            AGIPlaceSearchResponse response = await Helper.HttpGetAsync&lt;AGIPlaceSearchResponse>(url, input.TimeoutSeconds).ConfigureAwait(false);\n\n            \/\/ In live mode, attempt backup URL if primary response is invalid\n            if (input.IsLive &amp;&amp; !IsValid(response))\n            {\n                var fallbackUrl = BuildUrl(input, BackupBaseUrl);\n                AGIPlaceSearchResponse fallbackResponse = await Helper.HttpGetAsync&lt;AGIPlaceSearchResponse>(fallbackUrl, input.TimeoutSeconds).ConfigureAwait(false);\n                return fallbackResponse;\n            }\n\n            return response;\n        }\n\n        \/\/\/ &lt;summary>\n        \/\/\/ Build the full request URL with encoded query string.\n        \/\/\/ &lt;\/summary>\n        \/\/\/ &lt;param name=\"input\">Input data for PlaceSearch.&lt;\/param>\n        \/\/\/ &lt;param name=\"baseUrl\">Base endpoint URL.&lt;\/param>\n        \/\/\/ &lt;returns>Complete request URL.&lt;\/returns>\n        private static string BuildUrl(PlaceSearchInput input, string baseUrl)\n        {\n            return baseUrl + \"?\" +\n                   $\"SingleLine={Helper.UrlEncode(input.SingleLine)}\" +\n                   $\"Address1={Helper.UrlEncode(input.Address1)}\" +\n                   $\"Address2={Helper.UrlEncode(input.Address2)}\" +\n                   $\"Address3={Helper.UrlEncode(input.Address3)}\" +\n                   $\"Address4={Helper.UrlEncode(input.Address4)}\" +\n                   $\"Address5={Helper.UrlEncode(input.Address5)}\" +\n                   $\"Locality={Helper.UrlEncode(input.Locality)}\" +\n                   $\"AdministrativeArea={Helper.UrlEncode(input.AdministrativeArea)}\" +\n                   $\"PostalCode={Helper.UrlEncode(input.PostalCode)}\" +\n                   $\"&amp;Country={Helper.UrlEncode(input.Country)}\" +\n                   $\"&amp;Boundaries={Helper.UrlEncode(input.Boundaries)}\" +\n                   $\"&amp;MaxResults={Helper.UrlEncode(input.MaxResults)}\" +\n                   $\"&amp;SearchType={Helper.UrlEncode(input.SearchType)}\" +\n                   $\"&amp;Extras={Helper.UrlEncode(input.Extras)}\" +\n                   $\"&amp;LicenseKey={Helper.UrlEncode(input.LicenseKey)}\";\n        }\n\n        \/\/\/ &lt;summary>\n        \/\/\/ Checks if the response is valid (non-null and no error).\n        \/\/\/ &lt;\/summary>\n        \/\/\/ &lt;param name=\"response\">Response to validate.&lt;\/param>\n        \/\/\/ &lt;returns>True if valid; otherwise false.&lt;\/returns>\n        private static bool IsValid(AGIPlaceSearchResponse response) => response?.Error == null || response.Error.TypeCode != \"3\";\n\n\n        \/\/\/ &lt;summary>\n        \/\/\/ Input parameters for the PlaceSearch operation.\n        \/\/\/ &lt;\/summary>\n        \/\/\/ &lt;param name=\"SingleLine\">Single-line address input. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"Address1\">Address line 1. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"Address2\">Address line 2. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"Address3\">Address line 3. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"Address4\">Address line 4. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"Address5\">Address line 5. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"Locality\">City or locality. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"AdministrativeArea\">State or province. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"PostalCode\">Zip or postal code. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"Country\">Country ISO code (e.g., \"US\", \"CA\"). - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"Boundaries\">Geolocation search boundaries. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"MaxResults\">Maximum number of results to return. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"SearchType\">Specifies place type to search for. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"Extras\">Additional search attributes. - Optional&lt;\/param>\n        \/\/\/ &lt;param name=\"LicenseKey\">Service Objects license key. - Required&lt;\/param>\n        \/\/\/ &lt;param name=\"IsLive\">True to use production+backup; false for trial only. - Required&lt;\/param>\n        \/\/\/ &lt;param name=\"TimeoutSeconds\">Request timeout in seconds (default: 15).&lt;\/param>\n        public record PlaceSearchInput(\n            string SingleLine = \"\",\n            string Address1 = \"\",\n            string Address2 = \"\",\n            string Address3 = \"\",\n            string Address4 = \"\",\n            string Address5 = \"\",\n            string Locality = \"\",\n            string AdministrativeArea = \"\",\n            string PostalCode = \"\",\n            string Country = \"\",\n            string Boundaries = \"\",\n            string MaxResults = \"\",\n            string SearchType = \"\",\n            string Extras = \"\",\n            string LicenseKey = \"\",\n            bool IsLive = true,\n            int TimeoutSeconds = 15\n        );\n    }\n}\n\n\n\ufeffusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Serialization;\n\nnamespace address_geocode_international_dot_net.REST\n{\n    \/\/\/ &lt;summary>\n    \/\/\/ Represents the AGI ReverseSearch API response (REST).\n    \/\/\/ &lt;\/summary>\n    [DataContract]\n    public class AGIReverseSearchResponse\n    {\n        public AGIReverseSearchResponse()\n        {\n            Locations = new List&lt;Location>();\n        }\n\n        [DataMember(Name = \"SearchInfo\")]\n        public SearchInfo? SearchInfo { get; set; }\n\n        [DataMember(Name = \"Locations\")]\n        public List&lt;Location> Locations { get; set; }\n\n        [DataMember(Name = \"Error\")]\n        public ErrorDetails? Error { get; set; }\n\n        public override string ToString()\n        {\n            string output = \"AGI Reverse Search Response:\\n\";\n            output += SearchInfo != null ? SearchInfo.ToString() : \"  SearchInfo: null\\n\";\n\n            output += Locations != null &amp;&amp; Locations.Count > 0\n                ? \"  Locations:\\n\" +\n                    string.Join(\"\", Locations.Select((loc, i) => $\"    [{i + 1}]:\\n{loc}\"))\n                : \"  Locations: []\\n\";\n\n            output += Error != null ? Error.ToString() : \"  Error: null\\n\";\n            return output;\n        }\n    }\n\n    \/\/\/ &lt;summary>\n    \/\/\/ Represents the AGI PlaceSearch API response (REST).\n    \/\/\/ &lt;\/summary>\n    [DataContract]\n    public class AGIPlaceSearchResponse\n    {\n        [DataMember(Name = \"SearchInfo\")]\n        public SearchInfo? SearchInfo { get; set; }\n\n        [DataMember(Name = \"Locations\")]\n        public Location[]? Locations { get; set; }\n\n        [DataMember(Name = \"Error\")]\n        public ErrorDetails? Error { get; set; }\n\n        public override string ToString()\n        {\n            string output = \"AGI Place Search Response:\\n\";\n            output += SearchInfo != null ? SearchInfo.ToString() : \"  SearchInfo: null\\n\";\n\n            if (Locations != null &amp;&amp; Locations.Length > 0)\n            {\n                output += \"  Locations:\\n\";\n                for (int i = 0; i &lt; Locations.Length; i++)\n                {\n                    output += $\"    [{i + 1}]:\\n{Locations[i]}\\n\";\n                }\n            }\n            else\n            {\n                output += \"  Locations: []\\n\";\n            }\n\n            output += Error != null ? Error.ToString() : \"  Error: null\\n\";\n            return output;\n        }\n    }\n\n    \/\/\/ &lt;summary>\n    \/\/\/ Search information block returned by the AGI service.\n    \/\/\/ &lt;\/summary>\n    [DataContract]\n    public class SearchInfo\n    {\n        [DataMember(Name = \"Status\")]\n        public string? Status { get; set; }\n\n        [DataMember(Name = \"NumberOfLocations\")]\n        public int? NumberOfLocations { get; set; }\n\n        [DataMember(Name = \"Notes\")]\n        public string? Notes { get; set; }\n\n        [DataMember(Name = \"NotesDesc\")]\n        public string? NotesDesc { get; set; }\n\n        [DataMember(Name = \"Warnings\")]\n        public string? Warnings { get; set; }\n\n        [DataMember(Name = \"WarningDesc\")]\n        public string? WarningDesc { get; set; }\n\n        public override string ToString()\n        {\n            string output = \"  SearchInfo:\\n\";\n            output += $\"    Status           : {Status}\\n\";\n            output += $\"    NumberOfLocations: {NumberOfLocations}\\n\";\n            output += $\"    Notes            : {Notes}\\n\";\n            output += $\"    NotesDesc        : {NotesDesc}\\n\";\n            output += $\"    Warnings         : {Warnings}\\n\";\n            output += $\"    WarningDesc      : {WarningDesc}\\n\";\n            return output;\n        }\n    }\n\n    \/\/\/ &lt;summary>\n    \/\/\/ Represents a geocoded location as returned by the AGI service.\n    \/\/\/ &lt;\/summary>\n    [DataContract]\n    public class Location\n    {\n        public Location()\n        {\n            AddressComponents = new AddressComponents();\n        }\n\n        [DataMember(Name = \"PrecisionLevel\")]\n        public double PrecisionLevel { get; set; }\n\n        [DataMember(Name = \"Type\")]\n        public string? Type { get; set; }\n\n        [DataMember(Name = \"Latitude\")]\n        public string? Latitude { get; set; }\n\n        [DataMember(Name = \"Longitude\")]\n        public string? Longitude { get; set; }\n\n        [DataMember(Name = \"AddressComponents\")]\n        public AddressComponents? AddressComponents { get; set; }\n\n        [DataMember(Name = \"PlaceName\")]\n        public string? PlaceName { get; set; }\n\n        [DataMember(Name = \"GoogleMapsURL\")]\n        public string? GoogleMapsURL { get; set; }\n\n        [DataMember(Name = \"BingMapsURL\")]\n        public string? BingMapsURL { get; set; }\n\n        [DataMember(Name = \"MapQuestURL\")]\n        public string? MapQuestURL { get; set; }\n\n        [DataMember(Name = \"StateFIPS\")]\n        public string? StateFIPS { get; set; }\n\n        [DataMember(Name = \"CountyFIPS\")]\n        public string? CountyFIPS { get; set; }\n\n        [DataMember(Name = \"ClassFP\")]\n        public string? ClassFP { get; set; }\n\n        public override string ToString()\n        {\n            string output = \"\";\n            output += $\"      Type          : {Type}\\n\";\n            output += $\"      PrecisionLevel: {PrecisionLevel}\\n\";\n            output += $\"      Latitude      : {Latitude}\\n\";\n            output += $\"      Longitude     : {Longitude}\\n\";\n            output += $\"      PlaceName     : {PlaceName}\\n\";\n            output += $\"      GoogleMapsURL : {GoogleMapsURL}\\n\";\n            output += $\"      BingMapsURL   : {BingMapsURL}\\n\";\n            output += $\"      MapQuestURL   : {MapQuestURL}\\n\";\n            output += $\"      StateFIPS     : {StateFIPS}\\n\";\n            output += $\"      CountyFIPS    : {CountyFIPS}\\n\";\n            output += $\"      ClassFP       : {ClassFP}\\n\";\n            output += AddressComponents != null\n                ? AddressComponents.ToString()\n                : \"      AddressComponents: null\\n\";\n            return output;\n        }\n    }\n\n    \/\/\/ &lt;summary>\n    \/\/\/ Address components returned within a location result.\n    \/\/\/ &lt;\/summary>\n    [DataContract]\n    public class AddressComponents\n    {\n        [DataMember(Name = \"PremiseNumber\")]\n        public string? PremiseNumber { get; set; }\n\n        [DataMember(Name = \"Thoroughfare\")]\n        public string? Thoroughfare { get; set; }\n\n        [DataMember(Name = \"DoubleDependentLocality\")]\n        public string? DoubleDependentLocality { get; set; }\n\n        [DataMember(Name = \"DependentLocality\")]\n        public string? DependentLocality { get; set; }\n\n        [DataMember(Name = \"Locality\")]\n        public string? Locality { get; set; }\n\n        [DataMember(Name = \"AdministrativeArea1\")]\n        public string? AdministrativeArea1 { get; set; }\n\n        [DataMember(Name = \"AdministrativeArea1Abbreviation\")]\n        public string? AdministrativeArea1Abbreviation { get; set; }\n\n        [DataMember(Name = \"AdministrativeArea2\")]\n        public string? AdministrativeArea2 { get; set; }\n\n        [DataMember(Name = \"AdministrativeArea2Abbreviation\")]\n        public string? AdministrativeArea2Abbreviation { get; set; }\n\n        [DataMember(Name = \"AdministrativeArea3\")]\n        public string? AdministrativeArea3 { get; set; }\n\n        [DataMember(Name = \"AdministrativeArea3Abbreviation\")]\n        public string? AdministrativeArea3Abbreviation { get; set; }\n\n        [DataMember(Name = \"AdministrativeArea4\")]\n        public string? AdministrativeArea4 { get; set; }\n\n        [DataMember(Name = \"AdministrativeArea4Abbreviation\")]\n        public string? AdministrativeArea4Abbreviation { get; set; }\n\n        [DataMember(Name = \"PostalCode\")]\n        public string? PostalCode { get; set; }\n\n        [DataMember(Name = \"Country\")]\n        public string? Country { get; set; }\n\n        [DataMember(Name = \"CountryISO2\")]\n        public string? CountryISO2 { get; set; }\n\n        [DataMember(Name = \"CountryISO3\")]\n        public string? CountryISO3 { get; set; }\n\n        [DataMember(Name = \"GoogleMapsURL\")]\n        public string? GoogleMapsURL { get; set; }\n\n        [DataMember(Name = \"PlaceName\")]\n        public string? PlaceName { get; set; }\n\n        [DataMember(Name = \"IsUnincorporated\")]\n        public string? IsUnincorporated { get; set; }\n\n        [DataMember(Name = \"TimeZone_UTC\")]\n        public string? TimeZone_UTC { get; set; }\n\n        [DataMember(Name = \"CongressCode\")]\n        public string? CongressCode { get; set; }\n\n        [DataMember(Name = \"CensusTract \")]\n        public string? CensusTract { get; set; }\n\n        [DataMember(Name = \"CensusGeoID \")]\n        public string? CensusGeoID { get; set; }\n\n        [DataMember(Name = \"ClassFP\")]\n        public string? ClassFP { get; set; }\n\n        [DataMember(Name = \"StateFIPS \")]\n        public string? StateFIPS { get; set; }\n\n        [DataMember(Name = \"SLDUST \")]\n        public string? SLDUST { get; set; }\n\n        [DataMember(Name = \"SLDLST \")]\n        public string? SLDLST { get; set; }\n\n        [DataMember(Name = \"CountyFIPS \")]\n        public string? CountyFIPS { get; set; }\n\n        [DataMember(Name = \"CensusBlock \")]\n        public string? CensusBlock { get; set; }\n        public override string ToString()\n        {\n            string output = \"      AddressComponents:\\n\";\n            output += $\"        PremiseNumber                  : {PremiseNumber}\\n\";\n            output += $\"        Thoroughfare                   : {Thoroughfare}\\n\";\n            output += $\"        DoubleDependentLocality        : {DoubleDependentLocality}\\n\";\n            output += $\"        DependentLocality              : {DependentLocality}\\n\";\n            output += $\"        Locality                       : {Locality}\\n\";\n            output += $\"        AdministrativeArea1            : {AdministrativeArea1}\\n\";\n            output += $\"        AdministrativeArea1Abbreviation: {AdministrativeArea1Abbreviation}\\n\";\n            output += $\"        AdministrativeArea2            : {AdministrativeArea2}\\n\";\n            output += $\"        AdministrativeArea2Abbreviation:{AdministrativeArea2Abbreviation}\\n\";\n            output += $\"        AdministrativeArea3            :{AdministrativeArea3}\\n\";\n            output += $\"        AdministrativeArea3Abbreviation:{AdministrativeArea3Abbreviation}\\n\";\n            output += $\"        AdministrativeArea4            :{AdministrativeArea4}\\n\";\n            output += $\"        AdministrativeArea4Abbreviation:{AdministrativeArea4Abbreviation}\\n\";\n            output += $\"        PostalCode                     : {PostalCode}\\n\";\n            output += $\"        Country                        : {Country}\\n\";\n            output += $\"        CountryISO2                    : {CountryISO2}\\n\";\n            output += $\"        CountryISO3                    : {CountryISO3}\\n\";\n            output += $\"        TimeZone_UTC                   : {TimeZone_UTC}\\n\";\n            output += $\"        CongressCode                   : {CongressCode}\\n\";\n            output += $\"        GoogleMapsURL                  : {GoogleMapsURL}\\n\";\n            output += $\"        PlaceName                      : {PlaceName}\\n\";\n            output += $\"        IsUnincorporated               : {IsUnincorporated}\\n\";\n            output += $\"        StateFIPS                      : {StateFIPS}\\n\";\n            output += $\"        CountyFIPS                     : {CountyFIPS}\\n\";\n            output += $\"        CensusTract                    : {CensusTract}\\n\";\n            output += $\"        CensusBlock                    : {CensusBlock}\\n\";\n            output += $\"        CensusGeoID                    : {CensusGeoID}\\n\";\n            output += $\"        ClassFP                        : {ClassFP}\\n\";\n            output += $\"        SLDUST                         : {SLDUST}\\n\";\n            output += $\"        SLDLST                         : {SLDLST}\\n\";\n\n\n            return output;\n        }\n    }\n\n    \/\/\/ &lt;summary>\n    \/\/\/ Error block returned if the API fails or receives invalid input.\n    \/\/\/ &lt;\/summary>\n    [DataContract]\n    public class ErrorDetails\n    {\n        [DataMember(Name = \"Type\")]\n        public string? Type { get; set; }\n\n        [DataMember(Name = \"TypeCode\")]\n        public string? TypeCode { get; set; }\n\n        [DataMember(Name = \"Desc\")]\n        public string? Desc { get; set; }\n\n        [DataMember(Name = \"DescCode\")]\n        public string? DescCode { get; set; }\n\n        public override string ToString()\n        {\n            string output = \"  Error:\\n\";\n            output += $\"    Type    : {Type}\\n\";\n            output += $\"    TypeCode: {TypeCode}\\n\";\n            output += $\"    Desc    : {Desc}\\n\";\n            output += $\"    DescCode: {DescCode}\\n\";\n            return output;\n        }\n    }\n}\n\n\ufeffusing System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing System.Web;\n\nnamespace address_geocode_international_dot_net.REST\n{\n    \/\/\/ &lt;summary>\n    \/\/\/ Helper class for performing HTTP GET requests with JSON response handling.\n    \/\/\/ &lt;\/summary>\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>Address Geocode &#8211; International Python<\/strong> <strong>Code Snippet<\/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=\"\">\ufeff'''\nService Objects - AGI PlaceSearch Client\n\nThis module provides the place_search function to search and geocode international places\nusing Service Objects' AGI PlaceSearch REST API. It supports trial\/live environments,\nfallback handling, and extended parameter support.\n\nFunctions:\n    place_search(single_line: str,\n                address1: str,\n                address2: str,\n                address3: str,\n                address4: str,\n                address5: str,\n                locality: str,\n                administrative_area: str,\n                postal_code: str,\n                country: str,\n                boundaries: str,\n                max_results: int,\n                search_type: str,\n                extras: str,\n                license_key: str,\n                is_live: bool) -> dict:\n'''\n\nimport requests\n\n# Endpoint URLs for AGI PlaceSearch\nPRIMARY_URL = \"https:\/\/sws.serviceobjects.com\/AGI\/api.svc\/json\/PlaceSearch\"\nBACKUP_URL = \"https:\/\/swsbackup.serviceobjects.com\/AGI\/api.svc\/PlaceSearch\"\nTRIAL_URL = \"https:\/\/trial.serviceobjects.com\/AGI\/api.svc\/json\/PlaceSearch\"\n\ndef place_search(single_line: str,\n                address1: str,\n                address2: str,\n                address3: str,\n                address4: str,\n                address5: str,\n                locality: str,\n                administrative_area: str,\n                postal_code: str,\n                country: str,\n                boundaries: str,\n                max_results: int,\n                search_type: str,\n                extras: str,\n                license_key: str,\n                is_live: bool) -> dict:\n    \"\"\"\n    Calls the AGI PlaceSearch API and returns the parsed response.\n\n    Parameters:\n        single_line (str): Full address or place name (takes priority).\n        address1\u20135 (str): Optional multiline address input fields.\n        locality (str): City or locality.\n        administrative_area (str): State, province, or region.\n        postal_code (str): ZIP or postal code.\n        country (str): ISO-2 country code.\n        boundaries (str): Optional boundary filter.\n        max_results (int): Number of results to return.\n        search_type (str): Type of search: Address, Locality, PostalCode, etc.\n        extras (str): Optional additional flags.\n        license_key (str): AGI API key.\n        is_live (bool): True for live endpoint; False for trial.\n\n    Returns:\n        dict: Parsed JSON response from the API.\n\n    Raises:\n        RuntimeError: If the API returns an error payload.\n        requests.RequestException: On network\/HTTP failures (trial mode).\n    \"\"\"\n\n    # Prepare query parameters for AGI API\n    params = {\n        \"SingleLine\": single_line,\n        \"Address1\": address1,\n        \"Address2\": address2,\n        \"Address3\": address3,\n        \"Address4\": address4,\n        \"Address5\": address5,\n        \"Locality\": locality,\n        \"AdministrativeArea\": administrative_area,\n        \"PostalCode\": postal_code,\n        \"Country\": country,\n        \"Boundaries\": boundaries,\n        \"MaxResults\": max_results,\n        \"SearchType\": search_type,\n        \"Extras\": extras,\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=10)\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 when live\n                response = requests.get(BACKUP_URL, params=params, timeout=10)\n                data = response.json()\n\n                # If still error, propagate exception\n                if \"Error\" in data:\n                    raise RuntimeError(f\"AGI PlaceSearch backup error: {data['Error']}\")\n            else:\n                # Trial mode should not fallback; error is terminal\n                return data\n\n        # Success: return parsed JSON data\n        return data\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=10)\n                response.raise_for_status()\n                data = response.json()\n                return data\n            except Exception as fallback_exc:\n                raise RuntimeError(\"AGI PlaceSearch unreachable on both endpoints\") from fallback_exc\n\n        else:\n            # In trial mode, propagate the network exception\n            raise RuntimeError(f\"AGI trial error: {str(req_exc)}\") from req_exc<\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-create-block-tab tab-panel\" role=\"tabpanel\" tabindex=\"0\">\n<p><strong>Address Geocode &#8211; International NodeJS Code Snippet<\/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 { PSResponse } from '.\/agi_response.js';\n\n\/**\n * @constant\n * @type {string}\n * @description The base URL for the live ServiceObjects Address Geocode International (AGI) API service.\n *\/\nconst LiveBaseUrl = 'https:\/\/sws.serviceobjects.com\/agi\/api.svc\/json\/';\n\n\/**\n * @constant\n * @type {string}\n * @description The base URL for the backup ServiceObjects Address Geocode International (AGI) API service.\n *\/\nconst BackupBaseUrl = 'https:\/\/swsbackup.serviceobjects.com\/agi\/api.svc\/json\/';\n\n\/**\n * @constant\n * @type {string}\n * @description The base URL for the trial ServiceObjects Address Geocode International (AGI) API service.\n *\/\nconst TrialBaseUrl = 'https:\/\/trial.serviceobjects.com\/agi\/api.svc\/json\/';\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.TypeCode 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 PlaceSearch 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}PlaceSearch?${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;PSResponse>\">A promise that resolves to a PSResponse 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 PSResponse(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 Address Geocode International (AGI) API's PlaceSearch endpoint,\n * retrieving geocoded location information for a given address or place with fallback to a backup endpoint for reliability in live mode.\n * &lt;\/summary>\n *\/\nconst PlaceSearchClient = {\n    \/**\n     * &lt;summary>\n     * Asynchronously invokes the PlaceSearch 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     * @param {string} SingleLine - The full address on one line. Optional; for best results, use parsed inputs.\n     * @param {string} Address1 - Address Line 1 of the international address. Optional.\n     * @param {string} Address2 - Address Line 2 of the international address. Optional.\n     * @param {string} Address3 - Address Line 3 of the international address. Optional.\n     * @param {string} Address4 - Address Line 4 of the international address. Optional.\n     * @param {string} Address5 - Address Line 5 of the international address. Optional.\n     * @param {string} Locality - The name of the locality (e.g., city, town). Optional.\n     * @param {string} AdministrativeArea - The administrative area (e.g., state, province). Optional.\n     * @param {string} PostalCode - The postal code. Optional.\n     * @param {string} Country - The country name or ISO 3166-1 Alpha-2\/Alpha-3 code. Required.\n     * @param {string} Boundaries - A comma-delimited list of coordinates for search boundaries. Optional; not currently used.\n     * @param {string} MaxResults - Maximum number of results (1-10). Defaults to '10'.\n     * @param {string} SearchType - Type of search (e.g., 'BestMatch', 'All'). Defaults to 'BestMatch'.\n     * @param {string} Extras - Comma-delimited list of extra features. Optional.\n     * @param {string} LicenseKey - Your license key to use the service. Required.\n     * @param {boolean} isLive - Value to determine whether to use the live or trial servers. Defaults to true.\n     * @param {number} timeoutSeconds - Timeout, in seconds, for the call to the service. Defaults to 15.\n     * @returns {Promise&lt;PSResponse>} - A promise that resolves to a PSResponse object.\n     *\/\n    async invokeAsync(SingleLine, Address1, Address2, Address3, Address4, Address5, Locality, AdministrativeArea, PostalCode, Country, Boundaries, MaxResults = '10', SearchType = 'BestMatch', Extras, LicenseKey, isLive = true, timeoutSeconds = 15) {\n        const params = {\n            SingleLine,\n            Address1,\n            Address2,\n            Address3,\n            Address4,\n            Address5,\n            Locality,\n            AdministrativeArea,\n            PostalCode,\n            Country,\n            Boundaries,\n            MaxResults,\n            SearchType,\n            Extras,\n            LicenseKey\n        };\n\n        \/\/ Remove null\/undefined params to avoid empty query params\n        \/\/Object.keys(params).forEach(key => params[key] == null &amp;&amp; delete params[key]);\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        return response;\n    },\n\n    \/**\n     * &lt;summary>\n     * Synchronously invokes the PlaceSearch API endpoint by wrapping the async call\n     * and awaiting its result immediately.\n     * &lt;\/summary>\n     * @param {string} SingleLine - The full address on one line. Optional; for best results, use parsed inputs.\n     * @param {string} Address1 - Address Line 1 of the international address. Optional.\n     * @param {string} Address2 - Address Line 2 of the international address. Optional.\n     * @param {string} Address3 - Address Line 3 of the international address. Optional.\n     * @param {string} Address4 - Address Line 4 of the international address. Optional.\n     * @param {string} Address5 - Address Line 5 of the international address. Optional.\n     * @param {string} Locality - The name of the locality (e.g., city, town). Optional.\n     * @param {string} AdministrativeArea - The administrative area (e.g., state, province). Optional.\n     * @param {string} PostalCode - The postal code. Optional.\n     * @param {string} Country - The country name or ISO 3166-1 Alpha-2\/Alpha-3 code. Required.\n     * @param {string} Boundaries - A comma-delimited list of coordinates for search boundaries. Optional; not currently used.\n     * @param {string} MaxResults - Maximum number of results (1-10). Defaults to '10'.\n     * @param {string} SearchType - Type of search (e.g., 'BestMatch', 'All'). Defaults to 'BestMatch'.\n     * @param {string} Extras - Comma-delimited list of extra features. Optional.\n     * @param {string} LicenseKey - Your license key to use the service. Required.\n     * @param {boolean} isLive - Value to determine whether to use the live or trial servers. Defaults to true.\n     * @param {number} timeoutSeconds - Timeout, in seconds, for the call to the service. Defaults to 15.\n     * @returns {PSResponse} - A PSResponse object with geocoded location details or an error.\n     *\/\n    invoke(SingleLine, Address1, Address2, Address3, Address4, Address5, Locality, AdministrativeArea, PostalCode, Country, Boundaries, MaxResults = '10', SearchType = 'BestMatch', Extras, LicenseKey, isLive = true, timeoutSeconds = 15) {\n        return (async () => await this.invokeAsync(\n            SingleLine, Address1, Address2, Address3, Address4, Address5, Locality, AdministrativeArea, PostalCode, Country, Boundaries, MaxResults, SearchType, Extras, LicenseKey, isLive, timeoutSeconds\n        ))();\n    }\n};\n\nexport { PlaceSearchClient, PSResponse };\n\n\nexport class SearchInfo {\n    constructor(data = {}) {\n        this.Status = data.Status;\n        this.NumberOfLocations = data.NumberOfLocations || 0;\n        this.Notes = data.Notes;\n        this.NotesDesc = data.NotesDesc;\n        this.Warnings = data.Warnings;\n        this.WarningDesc = data.WarningDesc;\n    }\n\n    toString() {\n        return `Status: ${this.Status}, ` +\n            `NumberOfLocations: ${this.NumberOfLocations}, ` +\n            `Notes: ${this.Notes}, ` +\n            `NotesDesc: ${this.NotesDesc}, ` +\n            `Warnings: ${this.Warnings}, ` +\n            `WarningDesc: ${this.WarningDesc}`;\n    }\n}\n\nexport class AddressComponents {\n    constructor(data = {}) {\n        this.PremiseNumber = data.PremiseNumber;\n        this.Thoroughfare = data.Thoroughfare;\n        this.DoubleDependentLocality = data.DoubleDependentLocality;\n        this.DependentLocality = data.DependentLocality;\n        this.Locality = data.Locality;\n        this.AdministrativeArea1 = data.AdministrativeArea1;\n        this.AdministrativeArea1Abbreviation = data.AdministrativeArea1Abbreviation;\n        this.AdministrativeArea2 = data.AdministrativeArea2;\n        this.AdministrativeArea2Abbreviation = data.AdministrativeArea2Abbreviation;\n        this.AdministrativeArea3 = data.AdministrativeArea3;\n        this.AdministrativeArea3Abbreviation = data.AdministrativeArea3Abbreviation;\n        this.AdministrativeArea4 = data.AdministrativeArea4;\n        this.AdministrativeArea4Abbreviation = data.AdministrativeArea4Abbreviation;\n        this.PostalCode = data.PostalCode;\n        this.Country = data.Country;\n        this.CountryISO2 = data.CountryISO2;\n        this.CountryISO3 = data.CountryISO3;\n        this.GoogleMapsURL = data.GoogleMapsURL;\n        this.PlaceName = data.PlaceName;\n        this.IsUnincorporated = data.IsUnincorporated;\n        this.StateFIPS = data.StateFIPS;\n        this.CountyFIPS = data.CountyFIPS;\n        this.CensusTract = data.CensusTract;\n        this.CensusBlock = data.CensusBlock;\n        this.CensusGeoID = data.CensusGeoID;\n        this.ClassFP = data.ClassFP;\n        this.CongressCode = data.CongressCode;\n        this.SLDUST = data.SLDUST;\n        this.SLDLST = data.SLDLST;\n        this.Timezone_UTC = data.Timezone_UTC;\n    }\n\n    toString() {\n        return `PremiseNumber: ${this.PremiseNumber}, ` +\n            `Thoroughfare: ${this.Thoroughfare}, ` +\n            `DoubleDependentLocality: ${this.DoubleDependentLocality}, ` +\n            `DependentLocality: ${this.DependentLocality}, ` +\n            `Locality: ${this.Locality}, ` +\n            `AdministrativeArea1: ${this.AdministrativeArea1}, ` +\n            `AdministrativeArea1Abbreviation: ${this.AdministrativeArea1Abbreviation}, ` +\n            `AdministrativeArea2: ${this.AdministrativeArea2}, ` +\n            `AdministrativeArea2Abbreviation: ${this.AdministrativeArea2Abbreviation}, ` +\n            `AdministrativeArea3: ${this.AdministrativeArea3}, ` +\n            `AdministrativeArea3Abbreviation: ${this.AdministrativeArea3Abbreviation}, ` +\n            `AdministrativeArea4: ${this.AdministrativeArea4}, ` +\n            `AdministrativeArea4Abbreviation: ${this.AdministrativeArea4Abbreviation}, ` +\n            `PostalCode: ${this.PostalCode}, ` +\n            `Country: ${this.Country}, ` +\n            `CountryISO2: ${this.CountryISO2}, ` +\n            `CountryISO3: ${this.CountryISO3}, ` +\n            `GoogleMapsURL: ${this.GoogleMapsURL}, ` +\n            `PlaceName: ${this.PlaceName}, ` +\n            `IsUnincorporated: ${this.IsUnincorporated}, ` +\n            `StateFIPS: ${this.StateFIPS}, ` +\n            `CountyFIPS: ${this.CountyFIPS}, ` +\n            `CensusTract: ${this.CensusTract}, ` +\n            `CensusBlock: ${this.CensusBlock}, ` +\n            `CensusGeoID: ${this.CensusGeoID}, ` +\n            `ClassFP: ${this.ClassFP}, ` +\n            `CongressCode: ${this.CongressCode}, ` +\n            `SLDUST: ${this.SLDUST}, ` +\n            `SLDLST: ${this.SLDLST}, ` +\n            `Timezone_UTC: ${this.Timezone_UTC}`;\n    }\n}\nexport class LocationInfo {\n    constructor(data = {}) {\n        this.PrecisionLevel = data.PrecisionLevel || 0;\n        this.Type = data.Type;\n        this.Latitude = data.Latitude;\n        this.Longitude = data.Longitude;\n        this.AddressComponents = data.AddressComponents ? new AddressComponents(data.AddressComponents) : null;\n    }\n\n    toString() {\n        return `PrecisionLevel: ${this.PrecisionLevel}, ` +\n            `Type: ${this.Type}, ` +\n            `Latitude: ${this.Latitude}, ` +\n            `Longitude: ${this.Longitude}, ` +\n            `AddressComponents: ${this.AddressComponents ? this.AddressComponents.toString() : 'null'}`;\n    }\n}\nexport class Error {\n    constructor(data = {}) {\n        this.Type = data.Type;\n        this.TypeCode = data.TypeCode;\n        this.Desc = data.Desc;\n        this.DescCode = data.DescCode;\n    }\n\n    toString() {\n        return `Type: ${this.Type}, TypeCode: ${this.TypeCode}, Desc: ${this.Desc}, DescCode: ${this.DescCode}`;\n    }\n}\n\nexport class PSResponse {\n    constructor(data = {}) {\n        this.SearchInfo = data.SearchInfo ? new SearchInfo(data.SearchInfo) : null;\n        this.Locations = (data.Locations || []).map(location => new LocationInfo(location));\n        this.Error = data.Error ? new Error(data.Error) : null;\n    }\n\n    toString() {\n        const locationsString = this.Locations.length\n            ? this.Locations.map(location => location.toString()).join(', ')\n            : 'None';\n        return `PSResponse: SearchInfo = ${this.SearchInfo ? this.SearchInfo.toString() : 'null'}, ` +\n            `Locations = [${locationsString}], ` +\n            `Error = ${this.Error ? this.Error.toString() : 'null'}`;\n    }\n}\nexport class RSResponse {\n    constructor(data = {}) {\n        this.SearchInfo = data.SearchInfo ? new SearchInfo(data.SearchInfo) : null;\n        this.Locations = (data.Locations || []).map(location => new LocationInfo(location));\n        this.Error = data.Error ? new Error(data.Error) : null;\n    }\n\n    toString() {\n        let result = 'RSResponse:\\n';\n        if (this.SearchInfo) {\n            result += `SearchInfo: ${this.SearchInfo.toString()}\\n`;\n        }\n        if (this.Locations &amp;&amp; this.Locations.length > 0) {\n            result += 'Locations:\\n';\n            result += this.Locations.map(location => location.toString()).join('\\n') + '\\n';\n        }\n        if (this.Error) {\n            result += `Error: ${this.Error.toString()}`;\n        }\n        return result;\n    }\n}\n\nexport default { PSResponse, RSResponse };<\/pre>\n<\/div>\n<\/div><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"parent":1814,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1820","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>AGI - REST<\/title>\n<meta name=\"description\" content=\"C#PythonNodeJS Address Geocode - International C# Code Snippet \ufeffusing System.Threading.Tasks; namespace address_geocode_international_dot_net.REST {\" \/>\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-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AGI - REST\" \/>\n<meta property=\"og:description\" content=\"C#PythonNodeJS Address Geocode - International C# Code Snippet \ufeffusing System.Threading.Tasks; namespace address_geocode_international_dot_net.REST {\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-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-10-08T17:46:31+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-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/\",\"url\":\"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/\",\"name\":\"AGI - REST\",\"isPartOf\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/#website\"},\"datePublished\":\"2022-11-08T00:12:02+00:00\",\"dateModified\":\"2025-10-08T17:46:31+00:00\",\"description\":\"C#PythonNodeJS Address Geocode - International C# Code Snippet \ufeffusing System.Threading.Tasks; namespace address_geocode_international_dot_net.REST {\",\"breadcrumb\":{\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.serviceobjects.com\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DOTS Address Geocode &#8211; International\",\"item\":\"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"AGI &#8211; Code Snippets and Sample Code\",\"item\":\"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"AGI &#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":"AGI - REST","description":"C#PythonNodeJS Address Geocode - International C# Code Snippet \ufeffusing System.Threading.Tasks; namespace address_geocode_international_dot_net.REST {","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-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/","og_locale":"en_US","og_type":"article","og_title":"AGI - REST","og_description":"C#PythonNodeJS Address Geocode - International C# Code Snippet \ufeffusing System.Threading.Tasks; namespace address_geocode_international_dot_net.REST {","og_url":"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/","og_site_name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","article_modified_time":"2025-10-08T17:46:31+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-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/","url":"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/","name":"AGI - REST","isPartOf":{"@id":"https:\/\/www.serviceobjects.com\/docs\/#website"},"datePublished":"2022-11-08T00:12:02+00:00","dateModified":"2025-10-08T17:46:31+00:00","description":"C#PythonNodeJS Address Geocode - International C# Code Snippet \ufeffusing System.Threading.Tasks; namespace address_geocode_international_dot_net.REST {","breadcrumb":{"@id":"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/agi-rest\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.serviceobjects.com\/docs\/"},{"@type":"ListItem","position":2,"name":"DOTS Address Geocode &#8211; International","item":"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/"},{"@type":"ListItem","position":3,"name":"AGI &#8211; Code Snippets and Sample Code","item":"https:\/\/www.serviceobjects.com\/docs\/dots-address-geocode-international\/agi-code-snippets-and-sample-code\/"},{"@type":"ListItem","position":4,"name":"AGI &#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\/1820","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=1820"}],"version-history":[{"count":15,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/1820\/revisions"}],"predecessor-version":[{"id":12380,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/1820\/revisions\/12380"}],"up":[{"embeddable":true,"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/1814"}],"wp:attachment":[{"href":"https:\/\/www.serviceobjects.com\/docs\/wp-json\/wp\/v2\/media?parent=1820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}