Street Address Validation in C#

Cloudmersive
2 min readFeb 16, 2021

Automating the validation of street addresses is a small but important step you can take to improve the fluidity of your business. Utilizing the Validate Street Address API on your website or in your system can prevent future pain points for users by verifying the information ahead of time.

To initiate the process, you can run the command to install the .NET Core SDK (.NET Framework also available):

Install-Package Cloudmersive.APIClient.NETCore.Validate -Version 2.0.2

Our next step is to create instance of the API using the API key, and then calling the validation function:

using System; 
using System.Diagnostics;
using Cloudmersive.APIClient.NETCore.Validate.Api;
using Cloudmersive.APIClient.NETCore.Validate.Client;
using Cloudmersive.APIClient.NETCore.Validate.Model;
namespace Example
{
public class AddressValidateAddressExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
var apiInstance = new AddressApi();
var input = new ValidateAddressRequest(); // ValidateAddressRequest | Input parse request
try
{
// Validate a street address
ValidateAddressResponse result = apiInstance.AddressValidateAddress(input);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AddressApi.AddressValidateAddress: " + e.Message );
}
}
}
}

The returned result will disclose if the input street address is valid or invalid; if it shows up as a valid, the API will also indicate the latitude and longitude of the location. This technology supports the full spectrum of addresses whether, local, national, or international. To retrieve your free API key and gain access to this and a hundreds of other APIs, simply head to the Cloudmersive website and register for an account.

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.