Closed Arlind-Prosperoware closed 5 years ago
Hello @Arlind-Prosperoware the rest api is this one,
http://api.geonames.org/countryInfoJSON?formatted=true&lang=en&username=${YOUR_USERNAME}&style=full
replace ${YOUR_USERNAME} with your username, you will get the json response. If something is wrong in the payload you should contact geonames directly, they have a dedicated forum here: http://forum.geonames.org/
Hi @kinotto , The issue seems to be resolved now. There are no more duplicate countries. Thanks.
great @Arlind-Prosperoware :)
Hello @kinotto ,
When I'm using the example code to get all the countries this is the REST API that is being invoked:
https://secure.geonames.org/countryInfoJSON?username=prosperoware&lang=en
and this API is returning duplicates.
The API that you mentioned is returning the correct format but its not the API thats being called by the code.
Hi @Arlind-Prosperoware , are you using the commercial tier? did you pass a token in the config object? try to avoid passing the token and see if you still get duplicates.
Anyways if you get duplicates you might ask directly in the geonames forum probably they can better address the problem and probably solve it :)
Im not sending the token at all and I'm not using the commercial tier.
This is my config:
{username: name, lan:'en', encoding:'JSON'}
https://secure.geonames.org/countryInfoJSON?username=username&lang=en This API request is returning duplicates and is not returning all the data.
http://api.geonames.org/countryInfoJSON?formatted=true&lang=en&username=username&style=full This API request is returning the correct data without duplicates
As i told you the payload of the response is not under my control, and i cannot filter the data in the library cause it wouldn't be the correct solution the purpose of this library is just to wrap their service into a js module. When you say duplicates i don't know at which countries you're referring to because i cannot find them, but a part from that if there is a bug in the service it is correct to raise it in order to make them fix it :)
When using the api to get all the countries
const countries = await geoNames.countryInfo({}) //get continents
I'm getting duplicate countries