wm-AllKids-tibi2023/api/jobs/requestTemperature.js
Grit-Grenzdoerfer 5f27fe0c5b Initial commit
2023-09-17 13:24:39 +02:00

10 lines
418 B
JavaScript

function requestTemperature() {
let response = context.http.fetch(
"https://api.openweathermap.org/data/2.5/weather?lat=50.98&lon=11.03&appid=21fa3d5930956682000f7a2db5f357c0"
)
let data = response.body.json()
let temperatureEntries = context.db.find("temperature")
context.db.update("temperature", temperatureEntries[0].id, { temperature: data.main.temp - 273.15 })
}
requestTemperature()