A FastAPI-based service providing info about countries, states, and cities.
- Fetch details of countries, states, and cities.
- Query states by country and cities by state and country.
- Supports pagination.
- Auto-generated Swagger documentation for testing and exploring routes.
- Python 3.10+
- SQLite3
git clone https://github.com/alexandros-lekkas/world-api.git
cd world-apipython -m venv venv
source venv/bin/activate # For Linux/MacOS
venv\Scripts\activate # For Windowspip install -r requirements.txt
uvicorn api.main:app --reload
GET /countries?page=<int>&pageSize=<int>
GET /countriies/{iso2}
GET /states?page=<int>&pageSize=<int>
GET /states/{country_iso2}?page=<int>&pageSize=<int>
GET /states/details/{country_iso2}/{state_code}
GET /cities?page=<int>&pageSize=<int>
GET /cities/{state_code}?page=<int>&pageSize=<int>
GET /cities/by-country/{country_iso2}?page=<int>&pageSize=<int>
By default, FastAPI enables Swagger UI and ReDoc documentation, available for testing and exploring API endpoints.
-
Swagger UI: http://127.0.0.1:8000/docs
-
ReDoc: http://127.0.0.1:8000/redoc
-
Developer: Alexandros Lekkas
-
Database: Country States Cities Database