Code Monkey home page Code Monkey logo

smartystreets.net's Introduction

StreetSmarts client library for .NET

Use of this API requires free registration here. Official documentation for SmartyStreets is here.


Making a request is easy.

First set up your client

_client = new SmartyStreetsClient(
    ConfigurationManager.AppSettings["smartystreets:AuthId"], 
    ConfigurationManager.AppSettings["smartystreets:AuthToken"]);

If you want to verify an address

var request = new StreetAddressRequest
{
    Street = "3785 s las vegs av.",
    City = "los vegos,",
    State = "nevada",
    Zipcode = "90210",
};

var response = await _client.StreetAddressAsync(request);
var result = await response.GetResultsAsync();

You can also use their zipcode library

private static async Task CityStateToZipcodeExample()
{
    var request = new ZipcodeRequest { City = "Los Angeles", State = "California" };

    var response = await _client.ZipcodeAsync(request);
    var result = await response.GetResultsAsync();
}

The official StreetSmarts API also allows for batch processing, which this API also supports.

var response = await _client.StreetAddressAsync(new[] { request });

If you want to set custom headers in the request

_client.HttpRequestHeaders.Add("x-standardize-only", "true")

If you want to have full control over deserialization and observing headers, the HttpResponseMessage is also included.

 var result = await response.ResponseMessage.Content.ReadAsStringAsync();

Please report any issues or suggestions. PRs appreciated.

smartystreets.net's People

Contributors

misinformeddna avatar

Watchers

Jeremy Paden avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.