ViaCep 4.1.511

dotnet add package ViaCep --version 4.1.511
                    
NuGet\Install-Package ViaCep -Version 4.1.511
                    
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.511" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ViaCep" Version="4.1.511" />
                    
Directory.Packages.props
<PackageReference Include="ViaCep" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ViaCep --version 4.1.511
                    
#r "nuget: ViaCep, 4.1.511"
                    
#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.
#:package ViaCep@4.1.511
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ViaCep&version=4.1.511
                    
Install as a Cake Addin
#tool nuget:?package=ViaCep&version=4.1.511
                    
Install as a Cake Tool

ViaCEP SDK .NET

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 (2)

Showing the top 2 NuGet packages that depend on ViaCep:

Package Downloads
DrCash.Application.SDK

Package Description

DrCash.Application

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.1.511 5,271 5/31/2024
4.1.510 381 5/28/2024
4.1.507 367 5/28/2024
4.1.502 367 5/28/2024
4.1.495 526 4/29/2024
4.1.492 377 4/29/2024
4.1.487 387 4/29/2024
4.1.480 384 4/22/2024
4.1.477 375 4/22/2024
4.1.474 407 4/15/2024
4.1.471 380 4/15/2024
4.1.466 439 4/8/2024
4.1.463 735 3/18/2024
4.1.460 447 3/18/2024
4.1.453 656 2/26/2024
4.1.449 483 2/26/2024
4.1.444 1,779 2/19/2024
4.1.441 499 2/19/2024
4.1.429 568 2/14/2024
4.1.423 566 2/12/2024
4.1.420 657 1/30/2024
4.1.417 573 1/29/2024
4.1.411 644 1/16/2024
4.1.408 595 1/16/2024
4.1.401 578 1/15/2024
4.1.394 624 1/8/2024
4.1.386 725 12/25/2023
4.1.383 668 12/25/2023
4.1.378 689 12/18/2023
4.1.373 687 12/14/2023
4.1.367 706 12/12/2023
4.1.364 692 12/12/2023
4.1.354 685 12/11/2023
4.1.345 708 12/4/2023
4.1.342 664 12/4/2023
4.1.337 759 12/4/2023
4.1.334 703 11/28/2023
4.1.331 699 11/21/2023
4.1.328 667 11/21/2023
4.1.323 704 11/21/2023
4.1.316 731 11/14/2023
4.1.311 685 11/14/2023
4.1.305 698 11/14/2023
4.1.300 725 11/10/2023
4.1.290 705 11/6/2023
4.1.287 686 11/6/2023
4.1.282 779 10/31/2023
4.1.276 3,026 10/18/2023
4.1.273 750 10/17/2023
4.1.268 703 10/17/2023
4.1.261 917 9/19/2023
4.1.258 799 9/18/2023
4.1.253 1,011 9/5/2023
4.1.250 795 9/5/2023
4.1.241 2,377 8/24/2023
4.1.238 890 8/14/2023
4.1.235 948 8/9/2023
4.1.232 936 8/1/2023
4.1.229 946 8/1/2023
4.1.224 933 8/1/2023
4.1.217 953 7/31/2023
4.1.208 926 7/29/2023
4.1.203 912 7/28/2023
4.1.196 890 7/28/2023
4.1.190 961 7/24/2023
4.1.188 938 7/24/2023
4.1.184 985 7/24/2023
4.1.149 945 7/17/2023
4.1.146 946 7/11/2023
4.1.143 965 7/11/2023
4.1.138 918 7/3/2023
4.1.135 981 6/15/2023
4.1.132 960 6/6/2023
4.1.131 939 6/6/2023
4.1.128 961 6/6/2023
4.1.123 1,626 5/24/2023
4.1.120 960 5/24/2023
4.1.115 947 5/24/2023
4.1.104 894 5/4/2023
4.1.101 937 5/3/2023
4.1.96 1,072 4/9/2023
4.1.92 984 4/4/2023
4.1.87 971 3/25/2023
4.1.79 973 3/23/2023
4.1.76 1,119 3/3/2023
4.1.73 976 3/3/2023
4.1.57 993 3/3/2023
4.1.54 1,161 1/24/2023
4.1.53 1,193 1/15/2023
4.1.48 1,048 1/15/2023
4.1.45 1,050 1/14/2023
4.1.40 1,062 1/14/2023
3.2.35 1,039 1/14/2023
3.2.32 1,130 12/25/2022
3.2.27 1,002 12/25/2022
3.2.19 30,180 6/21/2021
3.1.5 11,491 10/23/2020
3.0.40 10,940 4/18/2020
3.0.38 2,011 4/7/2020
3.0.30 1,375 3/30/2020
3.0.23 1,408 3/29/2020
3.0.15 1,389 3/29/2020
3.0.12 1,328 3/29/2020
3.0.9 1,492 3/28/2020
2.0.93 5,717 3/28/2020
2.0.92 1,433 3/28/2020
2.0.89 1,429 3/28/2020
2.0.88 1,442 3/28/2020
2.0.80 1,477 3/28/2020
2.0.64 6,810 12/30/2019
2.0.61 20,991 12/3/2019
2.0.58 2,227 9/22/2019
2.0.48 3,411 2/15/2019
2.0.47 1,612 2/15/2019
1.0.0 1,553 2/15/2019