👋 Welcome to the Sri Lanka Administrative Data API repository! This API provides access to provinces, districts, and division data in Sri Lanka.
- Clone the repository:
git clone https://github.com/sudeepaviraj/administrative-api-srilanka.git- Navigate to the project directory:
cd administrative-api-srilanka- Install the required dependencies:
pip install -r requirements.txtYou Need to configure this application before use
-
Create a database named
srilankav2in your sql server -
Import
srilanka.sqlto your own sql server -
Create a
.envfile and add database connection values
DATABASE_HOST="YOUR DATABASE HOST"
DATABASE_PORT="YOUR DATABASE PORT"
DATABASE_USER="YOUR DATABASE USER"
DATABASE_PASSWORD="YOUR DATABASE PASSWORD"
DATABASE_NAME="srilankav2"
- Run the application:
python app.py- Once the application is running, you can access the API endpoints:
- Get all provinces:
/provinces - Get all districts:
/districts - Get all divisions:
/divisions - Get all districts in a province:
/getdistricts?province={province_id} - Get all divisions in a district:
/getdivisons?district={district_id} - Get all villages in a division:
/villages?division={division_id}
- Make HTTP GET requests to the desired endpoints using tools like
curlorPostmanto retrieve the administrative data.
Example request using curl:
curl http://localhost:5000/provincesExample response:
[
[
63,
"Western",
"බස්නාහිර",
"மேற்கு"
],
[
64,
"Central",
"මධ්යම",
"மத்திய"
]
]provinces,districts and divisions
[
"PROVINCE_ID",
"NAME_EN",
"NAME_SI",
"NAME_TA"
]villages
[
[
"LIFE_CODE",
"GN_CODE",
"MPA_CODE",
"NAME_EN",
"NAME_SI",
"NAME_TA"
]
]Under Development
https://db.famed.cloud/
You can run sql queries form your own application directly. To do that please use database file srilankav2.sql to your own mysql server
We welcome contributions to improve this project! If you'd like to contribute, please follow these steps:
-
Fork the repository.
-
Create a new branch for your feature:
git checkout -b feature/your-feature-name- Make your changes and commit them:
git commit -m "Add your commit message"- Push your changes to your forked repository:
git push origin feature/your-feature-name- Open a pull request, and we'll review your changes.
This project is licensed under the MIT License.
