Local forecast with detailed weather info, crowdsource weather data
Get name
from current weather API
Show temp
on first row. Show weather[0].description
on weather description on second row. Show temp
/feels_like
on third row.
All fileds can obtained from current weather API
Show 6 forecast data from forecast api. Show time, weather icon, temp
and feels_like
for each forecast
Fetch weather icon from appending weather.icon
to bellow base url
http://openweathermap.org/img/wn/{{weather_icon}}@2x.png
For example:
...
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10n"
}
],
...
will have icon url: http://openweathermap.org/img/wn/[email protected]
Place sun icon along dashed line with according to sys.sunrise
and sys.sunset
. Animate sun movement from sunrise location to desired location
For example: sunrise is on 5:32AM and sunset on 5:46PM. sun icon will be on top center of dashed line on 12:39PM. We got 12:39 PM from this formula:
sunrise + (sunset-sunrise)/2
You can access this menu by click account icon on top left of homepage or loggin button on register page. Use appropriate input type for each fields. Save access token from Login API for uploading report in report page. Show error message if Login API returns error
You can access this menu by click register button on Login Page. Use appropriate input type for each fields. Save access token from Register API for uploading report in report page. User should have password length must be greater than 5 and mixes of characters, numeric and symbols.
You can access this page by click add icon/button on top right of homepage. Show logged in username in the greeting placeholder, ask user to login if access token is expired. Open gallery for user to select image when upload button / icon clicked. User should not upload file more than 10MB and only input temperature between -25 and 100.
Postman Collection
https://www.getpostman.com/collections/f640ada705f43a3a63a7
Use this host for all APIs
http://18.140.243.251/api/v1
-
Path:
/weathers/current
-
Method:
GET
-
Params:
- lat - user's latitude
- lon - user's longitude
-
Heades:
Accept
=application/json
-
Response:
- temperature unit in celcius
- timestamp in UTC
Sample:
- Request:
curl -X GET \ 'http://18.140.243.251/api/v1/weathers/current?lat=-6.164713&lon=106.725050' \ -H 'Accept: application/json' \ -H 'Postman-Token: ccb7600f-484c-439f-afa9-e96e697d1927' \ -H 'cache-control: no-cache'
- Response:
{ "data": { "coord": { "lon": 106.73, "lat": -6.16 }, "weather": [ { "id": 802, "main": "Clouds", "description": "scattered clouds", "icon": "03d" } ], "base": "stations", "main": { "temp": 32.01, "feels_like": 34.09, "temp_min": 31, "temp_max": 32.78, "pressure": 1009, "humidity": 55 }, "visibility": 8000, "wind": { "speed": 3.6, "deg": 50 }, "clouds": { "all": 40 }, "dt": 1602994386, "sys": { "type": 1, "id": 9384, "country": "ID", "sunrise": 1602973827, "sunset": 1603017940 }, "timezone": 25200, "id": 1993378, "name": "Cideng", "cod": 200 }, "meta": { "version": "1", "hostname": "Komalas-MacBook-Pro.local", "client_ip": "127.0.0.1" } }
-
Path:
/weathers/forecast
-
Method:
GET
-
Params:
- lat - user's latitude
- lon - user's longitude
-
Heades:
Accept
=application/json
-
Response:
- temperature unit in celcius
- timezone in UTC
Sample:
- Request:
curl -X GET \ 'http://18.140.243.251/api/v1/weathers/forecast?lat=-6.164713&lon=106.725050' \ -H 'Accept: application/json' \ -H 'Postman-Token: 38efce77-c68c-4747-9dfd-bef4068edd74' \ -H 'cache-control: no-cache'
- Response:
{ "data": { "lat": -6.16, "lon": 106.73, "timezone": "Asia/Jakarta", "timezone_offset": 25200, "current": { "dt": 1602994982, "sunrise": 1602973827, "sunset": 1603017940, "temp": 31.56, "feels_like": 33.43, "pressure": 1009, "humidity": 55, "dew_point": 21.42, "uvi": 14.28, "clouds": 40, "visibility": 8000, "wind_speed": 3.6, "wind_deg": 50, "weather": [ { "id": 802, "main": "Clouds", "description": "scattered clouds", "icon": "03d" } ] }, "hourly": [ { "dt": 1602993600, "temp": 31.56, "feels_like": 34.08, "pressure": 1009, "humidity": 55, "dew_point": 21.42, "clouds": 40, "visibility": 10000, "wind_speed": 2.67, "wind_deg": 13, "weather": [ { "id": 802, "main": "Clouds", "description": "scattered clouds", "icon": "03d" } ], "pop": 0.05 }, { "dt": 1602997200, "temp": 31.46, "feels_like": 33.38, "pressure": 1009, "humidity": 54, "dew_point": 21.03, "clouds": 53, "visibility": 10000, "wind_speed": 3.24, "wind_deg": 5, "weather": [ { "id": 803, "main": "Clouds", "description": "broken clouds", "icon": "04d" } ], "pop": 0.18 }, ] }, "meta": { "version": "1", "hostname": "Komalas-MacBook-Pro.local", "client_ip": "127.0.0.1" } }
- Path:
/weathers/report
- Method:
POST
- Request Body:
- lat - user's latitude
- lon - user's longitude
- image
- temperature - between -25 and 100
- Heades:
Accept
=application/json
Content-Type
=application/json
-
Path:
/auth
-
Method:
POST
-
Request Body:
- username
- password
-
Heades:
Accept
=application/json
Content-Type
=application/json
-
Response:
- signature
- expires_in - signature valid time countdown
Sample:
- Request:
curl -X POST \ http://18.140.243.251/api/v1/auth \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Postman-Token: 08490f1e-98f0-446f-8fa1-01c0de8ee1f0' \ -H 'cache-control: no-cache' \ -d '{ "username":"komalasurya2", "password":"secret1" }'
- Response:
{ "data": { "expires_in": 3600, "signature": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkNjY1M2NhMS05OGJlLTQwNjItODViZC01ZTRmNmVjMWRkMTkiLCJ1c2VybmFtZSI6ImtvbWFsYXN1cnlhMiIsImV4cCI6MTYwMjk5NzkwMX0.qsZNZ0Z5GWqVHzlKmTrrIrk8a7Ik2bBzMwDqzSZShKU9OBsI5B5gENn4_Xinh0Hq9NqZckSJYtd0M3cHfjtcLQ" }, "meta": { "version": "1", "hostname": "Komalas-MacBook-Pro.local", "client_ip": "127.0.0.1" } }
-
Path:
/users
-
Method:
POST
-
Request Body:
- username
- password
-
Heades:
Accept
=application/json
Content-Type
=application/json
Sample:
- Request:
curl -X POST \ http://18.140.243.251/api/v1/users \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Postman-Token: 752254c1-f355-4890-bc3f-695aa0549850' \ -H 'cache-control: no-cache' \ -d '{ "username":"komalasurya2", "email": "[email protected]", "password":"secret1" }'
- Response:
{ "data": { "username": "komalasurya", "email": "[email protected]", "password": "$2y$10$kRxB0N.xsW3OS/aRfV0DVuFVFdOpvBuBaKWZPJpcSnHxwLv1XCLXi", "id": "011b1ceb-30dd-4777-87c9-b41b204988f4", "updated_at": "2020-10-18 06:17:10", "created_at": "2020-10-18 06:17:10" }, "meta": { "version": "1", "hostname": "Komalas-MacBook-Pro.local", "client_ip": "127.0.0.1" } }
Oneweather