DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Laurent Egbakou
Laurent Egbakou

Posted on • Originally published at Medium on

Getting Started with RESTCountries.NET

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

Possibles values 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.

Top comments (0)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.