Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
Why does restcountries API does not work while my Javascript code is correct

I'm trying to get data about countries using Rest Countries API by using link which is inside Github repository https://github.com/public-apis/public-apis. And when I open this API This is what I get. {"message":"Page Not Found","_links":{"self":{"href":"/","templated":false}}}.

And this is my Javascript Code

  const getCountryData = function (country) {
  const request = new XMLHttpRequest();
  request.open('GET', `https://restcountries.eu/rest/v2/name/${country}`);
  request.send();
  request.addEventListener('load', function () {
    console.log(this.responseText);
  });
};

getCountryData('rwanda');
getCountryData('brazil');

What is this happening ???

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

when I try to open the restcountries.eu site it redirects me to this http://countrylayer.com/ site maybe they have changed the domain or if you cannot figure it out then you can check out this site and see if it help you to do what you want to :

https://github.com/samayo/country-json

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!