ViaCep 4.1.261

.NET Standard 2.0
dotnet add package ViaCep --version 4.1.261
NuGet\Install-Package ViaCep -Version 4.1.261
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ViaCep" Version="4.1.261" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ViaCep --version 4.1.261
#r "nuget: ViaCep, 4.1.261"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ViaCep as a Cake Addin
#addin nuget:?package=ViaCep&version=4.1.261

// Install ViaCep as a Cake Tool
#tool nuget:?package=ViaCep&version=4.1.261

ViaCEP

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

GitHub license time tracker

Via CEP

CI/CD

Build status Last commit Tests Coverage Code Smells LOC
Build status GitHub last commit AppVeyor tests (branch) Coverage Code Smells Lines of Code

Code Quality

Codacy Badge Codacy Badge

codecov CodeFactor

Maintainability Test Coverage

Quality Gate Status Maintainability Rating

Technical Debt Duplicated Lines (%)

Reliability Rating Security Rating

Bugs Vulnerabilities

DeepSource


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

  • 2023-07-28: Add integration tests #71 by @Riju-bak
  • 2023-03-03: Update dependencies, change branch name, update logo. @guibranco
  • 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
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.1.261 68 9/19/2023
4.1.258 40 9/18/2023
4.1.253 122 9/5/2023
4.1.250 57 9/5/2023
4.1.241 172 8/24/2023
4.1.238 129 8/14/2023
4.1.235 143 8/9/2023
4.1.232 175 8/1/2023
4.1.229 192 8/1/2023
4.1.224 171 8/1/2023
4.1.217 184 7/31/2023
4.1.208 176 7/29/2023
4.1.203 158 7/28/2023
4.1.196 153 7/28/2023
4.1.190 205 7/24/2023
4.1.188 204 7/24/2023
4.1.184 194 7/24/2023
4.1.149 189 7/17/2023
4.1.146 210 7/11/2023
4.1.143 198 7/11/2023
4.1.138 166 7/3/2023
4.1.135 189 6/15/2023
4.1.132 206 6/6/2023
4.1.131 169 6/6/2023
4.1.128 171 6/6/2023
4.1.123 360 5/24/2023
4.1.120 167 5/24/2023
4.1.115 182 5/24/2023
4.1.104 178 5/4/2023
4.1.101 166 5/3/2023
4.1.96 267 4/9/2023
4.1.92 227 4/4/2023
4.1.87 233 3/25/2023
4.1.79 246 3/23/2023
4.1.76 345 3/3/2023
4.1.73 240 3/3/2023
4.1.57 272 3/3/2023
4.1.54 361 1/24/2023
4.1.53 373 1/15/2023
4.1.48 315 1/15/2023
4.1.45 304 1/14/2023
4.1.40 302 1/14/2023
3.2.35 293 1/14/2023
3.2.32 342 12/25/2022
3.2.27 282 12/25/2022
3.2.19 11,566 6/21/2021
3.1.5 6,843 10/23/2020
3.0.40 4,059 4/18/2020
3.0.38 1,186 4/7/2020
3.0.30 543 3/30/2020
3.0.23 560 3/29/2020
3.0.15 550 3/29/2020
3.0.12 545 3/29/2020
3.0.9 659 3/28/2020
2.0.93 1,495 3/28/2020
2.0.92 598 3/28/2020
2.0.89 586 3/28/2020
2.0.88 584 3/28/2020
2.0.80 604 3/28/2020
2.0.64 5,610 12/30/2019
2.0.61 9,380 12/3/2019
2.0.58 1,354 9/22/2019
2.0.48 2,553 2/15/2019
2.0.47 749 2/15/2019
1.0.0 712 2/15/2019