Task-6 Learn APIs and FastAPI
Description
This Merge Request implements Task 6 – Learn APIs and FastAPI by exploring public API usage and developing a simple backend application using FastAPI. The implementation demonstrates API concepts such as handling requests, returning JSON responses, and creating custom API endpoints.
Features Implemented
1. Public API Integration
- Integrated a public weather API using OpenWeather API.
- Implemented functionality to fetch weather details for a given city.
- Explored API request handling, JSON responses, and API usage limits.
2. FastAPI Application Development
- Created a basic FastAPI application with multiple endpoints.
Greeting Endpoint
- Implemented:
GET /greet/{name}
- Returns a personalized greeting response in JSON format.
Village Management APIs
- Implemented:
GET /villages
- Returns the list of village names.
POST /add-village
- Adds a new village to the in-memory list.
3. API Testing
-
Tested API endpoints using:
- FastAPI Swagger UI
- Postman
- Browser-based requests
Technologies Used
- Python
- FastAPI
- Uvicorn
- OpenWeather API
- Postman
Outcome
This implementation provides practical understanding of:
- API request-response architecture
- Public API integration
- Backend API development using FastAPI
- JSON data handling
- REST API concepts and endpoint creation
Testing Performed
- Verified successful weather data retrieval from the public API.
- Tested all FastAPI endpoints locally.
- Validated GET and POST request handling.
- Confirmed proper JSON response formatting.
- Tested API functionality through Swagger UI and Postman.
Future Improvements
- Add database integration for persistent storage
- Implement input validation and error handling
- Add authentication and security features
- Extend APIs with update and delete operations
Closes #3 (closed)
