All Projects → guibranco → ViaCEP

guibranco / ViaCEP

Licence: MIT license
The ViaCEP API/webservice .NET client

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to ViaCEP

Cep Promise
Busca por CEP integrado diretamente aos serviços dos Correios, ViaCEP e outros (Node.js e Browser)
Stars: ✭ 2,483 (+11723.81%)
Mutual labels:  cep, correios, zipcode, viacep
correios-cep-elixir
Find Brazilian addresses by postal code, directly from Correios API. No HTML parsers.
Stars: ✭ 38 (+80.95%)
Mutual labels:  cep, correios, zipcode
viacep
ViaCEP - Consulte CEPs de todo o Brasil
Stars: ✭ 44 (+109.52%)
Mutual labels:  cep, viacep
postal-codes-json-xml-csv
Collection of postal codes in different formats, ready for importing.
Stars: ✭ 181 (+761.9%)
Mutual labels:  zipcode, postal
consultacep
🇧🇷 Consulta CEP é uma aplicação básica para consulta de CEP
Stars: ✭ 21 (+0%)
Mutual labels:  cep, zipcode
city-codes
Brazilian city names and official codes, IBGE, LexML and others
Stars: ✭ 39 (+85.71%)
Mutual labels:  cep, ibge
Zipcodes
A simple library for querying U.S. zipcodes.
Stars: ✭ 63 (+200%)
Mutual labels:  zipcode, postal
correios-java-sdk
Correios Java SDK
Stars: ✭ 28 (+33.33%)
Mutual labels:  webservice, correios
vicopo
API HTTP et Script pour trouver les villes à partir d'un code postal et code postaux à partir d'une ville
Stars: ✭ 27 (+28.57%)
Mutual labels:  code, postal
twzipcode
正規化台灣地址,並取得縣市、鄉鎮、區碼
Stars: ✭ 88 (+319.05%)
Mutual labels:  zip, zipcode
gogen
Command-line tool to generate GO applications and libraries
Stars: ✭ 17 (-19.05%)
Mutual labels:  code
address-index-api
Address Index is an application which resolves addresses
Stars: ✭ 26 (+23.81%)
Mutual labels:  address
m2.ShowAddressFields
Magento2. Show Address Fields in Customer Registration Form.
Stars: ✭ 17 (-19.05%)
Mutual labels:  address
deploy-ml-model
Deploying a simple machine learning model to an AWS ec2 instance using flask and docker.
Stars: ✭ 70 (+233.33%)
Mutual labels:  webservice
gintonic
A declarative transformation language for GraphQL 🍸
Stars: ✭ 27 (+28.57%)
Mutual labels:  code
generaptr
Generaptr is a node package that helps when starting up a project by generating boilerplate code for Express api.
Stars: ✭ 16 (-23.81%)
Mutual labels:  code
advanced-cloud-native-go
Advanced Cloud Native Go - Packt Publishing Video Course
Stars: ✭ 18 (-14.29%)
Mutual labels:  webservice
wipri
(Network Metadata Privacy) MAC Address spoofer with bonus combo (options): hostname + signal spoofer - *no disconnects!* Privacy Changing w/Brand Mimics: run as command or optional new randomized identity each boot; includes flags for continually changing random times/changing valid OUI addresses + Hostname randomizer + Device/Signal/location an…
Stars: ✭ 26 (+23.81%)
Mutual labels:  address
cashaddress
Python tool for convert bitcoin cash legacy addresses
Stars: ✭ 40 (+90.48%)
Mutual labels:  address
PySiddhi
Python wrapper for Siddhi engine
Stars: ✭ 22 (+4.76%)
Mutual labels:  cep

ViaCEP

A .NET client wrapper for both .NET Core & .NET Framework projects of Via CEP API

GitHub license time tracker

Via CEP

CI/CD

Branch Build status Last commit Tests
Master Build status GitHub last commit AppVeyor tests (branch)
Develop Build status GitHub last commit AppVeyor tests (branch)

Code Quality

Codacy Badge codecov Quality Gate Status Coverage

Maintainability Rating Lines of Code Technical Debt Duplicated Lines (%)

Reliability Rating Security Rating Code Smells Bugs Vulnerabilities


Installation

Github Releases

GitHub last release Github All Releases

Download the latest zip file from the Release page.

Nuget package manager

Package Version Downloads
ViaCEP ViaCEP NuGet Version ViaCEP NuGet Downloads

Usage

The package has two classes:

This package is fully compatible with Dependency Injection. Use the interface IViaCepClient and the constructor with HttpClient parameter with a IHttpClientFactory instance.

//your DI container
services.AddHttpClient<IViaCepClient, ViaCepClient>(client => { client.BaseAddress = new Uri("https://viacep.com.br/"); });

//then use in your domain service, handler, controller...
var viaCepClient = container.GetService<IViaCepClient>();
var result = await viaCepClient.SearchAsync("01001000", cancellationToken);

You can search using the zip code/postal code (AKA CEP) or using the address data (state initials - UF, city name and location name - street, avenue, park, square). Both methods support async and sync!

Querying by zip code / postal code (single result)

var result = new ViaCepClient().Search("01001000"); //searches for the postal code 01001-000
var address = result.Address; //Praça da Sé
var city = reuslt.City; //São Paulo
//do what you need with 'result' instance of ViaCEPResult.

Querying by address (list result)

var results = new ViaCepClient().Search("SP", "São Paulo", "Avenida Paulista"); //search for the Avenida Paulista in São Paulo / SP
foreach(var result in results){
    var address = result.Address;
    var neighborhood = result.Neighborhood;
    var zipCode = result.ZipCode;
    //do what you need with 'result' instance of ViaCEPResult.
}

Changelog

  • 2021-06-21: Update dependencies version. @guibranco
  • 2020-10-23: Add support to .NET Standard 2.0 and .NET Framework v4.6.1 and above. @guibranco
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].