static void Main(string[] args) { var apiKey = ExampleUtils.GetApiKey(args); var client = new Client(apiKey); var query = new LocationQuery(StreetLine1, StreetLine2, City, StateCode, PostalCode); Response<ILocation> response; try { response = client.FindLocations(query); } catch (FindException) { System.Console.Out.WriteLine("ReverseAddress lookup for {0}; {1}; {2}; {3}; {4} failed!", StreetLine1, StreetLine2, City, StateCode, PostalCode); throw; } if ((response != null) && (response.IsSuccess)) { var results = response.Results; System.Console.Out.WriteLine("ReverseAddress lookup for {0}; {1}; {2}; {3}; {4} was successful, returning {5} root location objects.{6}{6}", StreetLine1, StreetLine2, City, StateCode, PostalCode, results.Count, System.Environment.NewLine); foreach (var location in results) { ExampleUtils.DumpLocation(location, 2); System.Console.Out.WriteLine(); } } #if DEBUG System.Console.Out.WriteLine("Press the ENTER key to quit..."); System.Console.In.ReadLine(); #endif }
public Response<ILocation> SearchProApi(string streetAddress, string city, string state, string postalCode) { Response<ILocation> response; var apiKey = ConfigurationManager.AppSettings["api_key"]; var client = new Client(apiKey); var query = new LocationQuery(streetAddress, null, city, state, postalCode); try { response = client.FindLocations(query); } catch (FindException) { throw new Exception(String.Format("ReverseAddress lookup for {0} {1} {2} {3} failed!", streetAddress, city, state, postalCode)); } return response; }