Getting Started with RESTCountries.NET

Kodjo Laurent Egbakou
Aug 11 · 2 min read

In this article, Let me show you my open source Nuget package RESTCountries.NET developed in .NET Standard.

RESTCountries.NET is a .NET Standard wrapper library around the API provided by REST Countries(https://restcountries.eu).

htpps://restcountries.eu is a RESTful API which provides information about countries such as name , capital city , population , currencies ,borders info , languages , flag , calling codes , etc.

With RESTCountries.NET, we can:

  • Retrieve a list of countries.
  • Get a list of country names in others languages such as German, Spanish, French, Italian, Portuguese, Dutch, Croatian, Japanese, Breton, and Persian language.
  • Search by country name.
  • Search by capital city.
  • Search by ISO 4217 currency code.
  • Search by continent: Africa, Americas, Asia, Europe, Oceania.
  • Search by regional bloc.
  • Apply filters to retrieve what we need.
  • etc.

Setup

Usage

  • Add namespace
  • Get all countries

Each method return an object of type Country or a List of Country. You can apply filters on the returned value to retrieve what you need.

  • Get a list of country names

Country names are in English by default.

  • Retrieve a list of country names in Spanish

Available languages are: de(German language), es(Spanish language), fr(French language), ja(Japanese language), it(Italian language), br(Breton language), pt(Portuguese language), nl(Dutch language), hr(Croatian language) and fa(Persian language).

  • Search by country partial name or full name

The first method could return a list of countries or a list of one element.

  • Search by continent: Africa, Americas, Asia, Europe, Oceania

Possible value of “continent” are Africa, Americas, Asia, Europe and Oceania.

For more information, check out the full documentation at https://github.com/egbakou/RESTCountries.NET

Conclusion

In web applications(.NET or .NET Core) RESTCountries.NET allows us to populate country select tag options dynamically. Populate Xamarin Picker with a list of countries become easy.

Kodjo Laurent Egbakou

Written by

C#/.Net/Xamarin and Spring Boot developer 👨🏽‍💻| Speaker | Blogger | https://planetxamarin.com Community Author | https://github.com/egbakou

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade