/TravelToCoolPlace

Travel Suggestion to Cool Place

Primary LanguageC#

TravelToCoolPlace

Travel Suggestion to Cool Place

Releases

v1.0

v1.0

API Definition

1. GetAuthenticated

Purpose : Verify user and provide a "Access Token"

API Endpoint : POST /GetAuthenticated

Request : https://localhost:7282/api/Weather/GetAuthenticated

[ Params ]
username = raskin
password = 123

Response
{
"accessToken": "",
"expires": ""
}

2. TemperatureForecasts

Purpose : Get the temperature forecasts of each districts for up to 7 days for 64 districts at 2pm

API Endpoint : GET /TemperatureForecasts

Request : https://localhost:7282/api/Weather/TemperatureForecasts

[ Header ]
Key = Authorization
Value = accessToken

Response
{
"2023-05-29T14:00:00": [
{
"name": "Dhaka",
"date": "2023-05-29T14:00:00",
"temperature": 31
},
.................

3. CoolestDistricts

Purpose : Get the coolest 10 districts based on the average temperature at 2pm for the next 7 days

API Endpoint : GET /CoolestDistricts

Request : https://localhost:7282/api/Weather/CoolestDistricts

[ Header ]
Key = Authorization
Value = accessToken

Response
[
{
"districtName": "Bandarban",
"averageTemperature": 29.442857142857143
},
............

4. TravelSuggestion

Purpose : Compare the temperature of Friend's location and my preffered locations at 2 PM on a given day and return a response where should they travel

API Endpoint : GET /TravelSuggestion

Request : https://localhost:7282/api/Weather/TravelSuggestion

[ Params ]
friendLocation =
destination =
travelDate

[ Header ]
Key = Authorization
Value = accessToken

Response
Your Location is Coolest, So You Should Travel to [coolest location]

Follow these steps to get started with this API.

Download Visual Studio 2022

Download and instal Visual Studio 2022 Link

Git URL of the Project

Clone the project from this Git Repo then run the application from visual studio 2022

Download the Extension

(If you don't find below extensions under Dependencies > Packages)

Right click on project and click Manage Nuget Packages then install below packages

  1. Microsoft.AspNetCore.Mvc.Newtonsoftjson(6.0.16)
  2. System.IdentityModel.Tokens.Jwt(6.30.1)
  3. Swashbuckle.AspNetCore.Annotations(6.5.0)

Test the APIs

  1. Run the application from Visual Studio
  2. Test the APIs endpoints using Postman
  3. OR, use swagger to test it. just go to here : https://localhost:7282/swagger

About the Author

Mohammad Raskinur Rashid