I tried using example API but seems some of the parameters missing. This is the API I tried.
public W_AddressStateCity GetAddressStateCityInfo(W_CustomerAddress oAddress)
{
W_AddressStateCity oAddStateCity = new W_AddressStateCity();
var client = new ClientBuilder(AuthID, AuthToken).BuildUsStreetApiClient();
var lookup = new Lookup
{
Street = oAddress.AddressStreetAddress1,
Street2 = oAddress.AddressStreetAddress2,
City = oAddress.AddressCity,
State = oAddress.AddressState,
ZipCode = oAddress.AddressZipCode
};
try
{
client.Send(lookup);
}
catch (SmartyException ex)
{
// Console.WriteLine(ex.Message);
// Console.WriteLine(ex.StackTrace);
}
var candidates = lookup.Result;
oAddStateCity.Country = candidates[0].Metadata.Country;
oAddStateCity.State = candidates[0].Metadata.State;
oAddStateCity.County = candidates[0].Metadata.CountyName;
oAddStateCity.City = candidates[0].Metadata.City;
return oAddStateCity;
}
Only CountyName is available in candidates. The address is always validated before fed into this API. How I could read Country, State and City ? I want to read that information from the API, nit from my provided address.