ViaCep 4.1.417

There is a newer version of this package available.
See the version list below for details.
dotnet add package ViaCep --version 4.1.417
NuGet\Install-Package ViaCep -Version 4.1.417
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.417" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ViaCep --version 4.1.417
#r "nuget: ViaCep, 4.1.417"
#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.417

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

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.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.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)
Included target framework(s) (in package)
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.466 78 4/8/2024
4.1.463 192 3/18/2024
4.1.460 115 3/18/2024
4.1.453 230 2/26/2024
4.1.449 179 2/26/2024
4.1.444 293 2/19/2024
4.1.441 187 2/19/2024
4.1.429 232 2/14/2024
4.1.423 232 2/12/2024
4.1.420 340 1/30/2024
4.1.417 259 1/29/2024
4.1.411 329 1/16/2024
4.1.408 283 1/16/2024
4.1.401 274 1/15/2024
4.1.394 328 1/8/2024
4.1.386 412 12/25/2023
4.1.383 374 12/25/2023
4.1.378 385 12/18/2023
4.1.373 388 12/14/2023
4.1.367 408 12/12/2023
4.1.364 388 12/12/2023
4.1.354 380 12/11/2023
4.1.345 431 12/4/2023
4.1.342 386 12/4/2023
4.1.337 451 12/4/2023
4.1.334 422 11/28/2023
4.1.331 408 11/21/2023
4.1.328 381 11/21/2023
4.1.323 418 11/21/2023
4.1.316 446 11/14/2023
4.1.311 393 11/14/2023
4.1.305 408 11/14/2023
4.1.300 416 11/10/2023
4.1.290 415 11/6/2023
4.1.287 408 11/6/2023
4.1.282 490 10/31/2023
4.1.276 1,859 10/18/2023
4.1.273 452 10/17/2023
4.1.268 415 10/17/2023
4.1.261 631 9/19/2023
4.1.258 494 9/18/2023
4.1.253 613 9/5/2023
4.1.250 474 9/5/2023
4.1.241 977 8/24/2023
4.1.238 557 8/14/2023
4.1.235 587 8/9/2023
4.1.232 620 8/1/2023
4.1.229 606 8/1/2023
4.1.224 615 8/1/2023
4.1.217 621 7/31/2023
4.1.208 602 7/29/2023
4.1.203 585 7/28/2023
4.1.196 580 7/28/2023
4.1.190 646 7/24/2023
4.1.188 630 7/24/2023
4.1.184 640 7/24/2023
4.1.149 614 7/17/2023
4.1.146 609 7/11/2023
4.1.143 643 7/11/2023
4.1.138 591 7/3/2023
4.1.135 637 6/15/2023
4.1.132 639 6/6/2023
4.1.131 579 6/6/2023
4.1.128 604 6/6/2023
4.1.123 870 5/24/2023
4.1.120 592 5/24/2023
4.1.115 582 5/24/2023
4.1.104 567 5/4/2023
4.1.101 588 5/3/2023
4.1.96 692 4/9/2023
4.1.92 646 4/4/2023
4.1.87 623 3/25/2023
4.1.79 641 3/23/2023
4.1.76 777 3/3/2023
4.1.73 646 3/3/2023
4.1.57 662 3/3/2023
4.1.54 793 1/24/2023
4.1.53 832 1/15/2023
4.1.48 735 1/15/2023
4.1.45 714 1/14/2023
4.1.40 715 1/14/2023
3.2.35 704 1/14/2023
3.2.32 752 12/25/2022
3.2.27 672 12/25/2022
3.2.19 17,268 6/21/2021
3.1.5 8,825 10/23/2020
3.0.40 5,874 4/18/2020
3.0.38 1,620 4/7/2020
3.0.30 997 3/30/2020
3.0.23 1,015 3/29/2020
3.0.15 1,006 3/29/2020
3.0.12 928 3/29/2020
3.0.9 1,073 3/28/2020
2.0.93 1,987 3/28/2020
2.0.92 1,046 3/28/2020
2.0.89 1,031 3/28/2020
2.0.88 1,042 3/28/2020
2.0.80 1,084 3/28/2020
2.0.64 6,156 12/30/2019
2.0.61 11,569 12/3/2019
2.0.58 1,815 9/22/2019
2.0.48 2,999 2/15/2019
2.0.47 1,210 2/15/2019
1.0.0 1,162 2/15/2019