RestAPI.Countries 1.0.2

.NET Core 2.0
There is a newer version of this package available.
See the version list below for details.
dotnet add package RestAPI.Countries --version 1.0.2
NuGet\Install-Package RestAPI.Countries -Version 1.0.2
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="RestAPI.Countries" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RestAPI.Countries --version 1.0.2
#r "nuget: RestAPI.Countries, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install RestAPI.Countries as a Cake Addin
#addin nuget:?package=RestAPI.Countries&version=1.0.2

// Install RestAPI.Countries as a Cake Tool
#tool nuget:?package=RestAPI.Countries&version=1.0.2

NuGet NuGet


DotNetCoreRESTCountry is a nuget package which acts as a Wrapper Library For REST Country API v2.0.5 provided by . REST countries API, includes information like common Name, official Name, TLD,two and three letter country code, ISO numeric code, CIOC,currencies, callingCodes, capital, alternative spellings, region, subRegion, borders, etc.


Download Nuget package either using Nuget Packekage Manager or .NET CLI
Using Nuget Package Manager Install-Package RestAPI.Countries -Version 1.0.1
Using .NET CLI dotnet add package RestAPI.Countries --version 1.0.1
Use Static methods defined in RestCountry Class to call the specific API Endpoints.

For Example RestCountry.Currency("cop") will make the GET Request to the endpoint of REST Countries API.

Static methods defined in RestCountry class returns a list of Country objects. Access the properties defined in Country class to get various information about the countries.
Methods defined in RestCountry Class takes in a list of strings as optional second parameter which filters the output of your request to include only the specified fields.
Make asynchronous requests to the API using the Async version of methods defined in RestCountry Class.


using DotNetRestCountries; // Reference Nuget Package
using System;
using System.Collections.Generic;

namespace TestConsole
    class Program
        static void Main(string[] args)
            // Call static methods listed in RestCountry class. 
            // These methods will return a List of Country Objects. 
	        // Use properties in Country Class to access all the informations like name, capital, calling codes, etc. for a given country
            List<Country> allCountries = RestCountry.All();
            foreach(var con in allCountries)
                Console.WriteLine(con.Name + " -- " + con.NativeName + " -- " + con.TopLevelDomain );


            //[FILTER RESPONSE] 
            // Pass an optional List of filters to obtain results with only the specified properties for countries

            // This will return a List of Countries having string "island" in their name. 
	        // Since we passed in the List of filters, the returned Country objects will only have values for Name and Capital Properties.

            List<Country> filteredResult = RestCountry.Name("island", new List<string> { Filters.Name, Filters.Capital });

            // Make asynchronous requests to the API using the Async version of methods defined in RestCountry Class.

            // Makes async request to the RESTCountries endpoint
            List<Country> asyncResult = RestCountry.CapitalAsync("Kathmandu");


Thanks to Fayder Florez for developing REST Countries API

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
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
1.0.4 766 7/24/2021
1.0.3 2,227 4/12/2020
1.0.2 9,750 9/1/2018
1.0.1 908 2/10/2018