Open LassPar opened 13 hours ago
Käytännössä vaatii oman käyttäjän ja aikaa tehdä oma. Valmista APIa joka ei vaatisi kirjautumista ei ole. Datan saaminen vaatii https://tankille.fi/ sovelluksn tilin.
import { Client } from '@jeffe/tankille'
const tankille = new Client()
async function getData () {
await tankille.login({
email,
password
})
const data = await tankille.getStationsByLocation(
{
lat: 61.500, // nämä jostain esim. google mapsista.
lon: 23.800
},
15000 // metreinä
)
}
Yllä oleva koodinpätkä hakee bensa-asemat 15km etäisyydellä tästä pisteestä.
Ja voihan sen itse implementoida myös.
POST https://api.tankille.fi/auth/login {"email": "sposti@orava.com", password: "salainen sana"}
POST https://api.tankille.fi/auth/refresh {"token": "token jonka sait auth/login routesta"}
GET https://api.tankille.fi/stations?location=LONGITUDE,LATITUDE&distance=15000
headereissa 'x-access-token':"auth/refresh/ saatu token"
Is there any way to get any (JSON) data with HTTP GET reguest? I would like to get data from my area (Tampere) to NodeRed and make some home automations based on gas price.