24 lines
1.2 KiB
Markdown
24 lines
1.2 KiB
Markdown
## weather_api
|
|
|
|
### Datacose Weather API
|
|
|
|
### Database Integration
|
|
|
|
- Implement SQLAlchemy with a local Postgres database.
|
|
- Design a `Location` model with attributes including id, name, latitude, and longitude.
|
|
|
|
### API Endpoints
|
|
|
|
- **Manage Locations:**
|
|
- `GET /locations`: Retrieve a list of all locations saved in the database, including their current weather conditions. This requires integrating with the [OpenMeteo API](https://open-meteo.com/) to fetch weather data based on latitude and longitude.
|
|
- `POST /locations`: Allow adding a new location by providing name, latitude, and longitude.
|
|
- `DELETE /locations/{id}`: Enable location deletion by ID.
|
|
|
|
- **Weather Forecast:**
|
|
- `GET /forecast/{location_id}`: Provide a detailed 7-day weather forecast for a specified location. This endpoint will call the OpenMeteo API to fetch forecast data based on the location's latitude and longitude stored in the database.
|
|
|
|
|
|
### API Integration
|
|
|
|
- To fetch weather information, you are to use the [OpenMeteo API](https://open-meteo.com/). Given that this API requires latitude and longitude for location data, utilize [this predefined list of locations](https://gist.github.com/ofou/df09a6834a8421b4f376c875194915c9) as your hardcoded source.
|