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 ???
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 :