GeoDB Cities

FREEMIUM
Verified
От Michael Mogley | Обновлено il y a 2 mois | Data
Популярность

9.9 / 10

Задержка

67ms

Уровень обслуживания

100%

Health Check

100%

Назад ко всем обсуждениям

Get all the available countries

Rapid account: Andredev 95
andredev95
il y a 17 jours

Hi!

I’m trying to build a dropdown input with html and vanilla js that shows a list of all known countries. However, when I do a fetch AJAX fetch call to https://wft-geo-db.p.rapidapi.com/v1/geo/countries, I’m returned the first 5 countries only. To get more, I have to set the optional limit parameter to a given number. In the documentation, it is clearly stated that if no criteria are set, you will get back all known countries.

What am I doing wrong?

Rapid account: Wirefreethought
wirefreethought Commented il y a 6 jours

Sorry for the late reply. RapidAPI did not send me a new-thread notification.

Yes you will get back all known countries, but you still need to page results. The way to page them is to use offset in combination with limit.

For example, first 5 results:

GET /v1/geo/countries?offset=0&limit=5

Next 5 results:

GET /v1/geo/countries?offset=5&limit=5

If you want to set a higher limit to get back more results in a single page, you’ll need to upgrade to the PRO plan (which currently offers a max limit = 100).

Присоединяйтесь к обсуждению – добавьте комментарий ниже:

Войдите / Зарегистрируйтесь, чтобы публиковать новые комментарии