Skip to content

Instantly share code, notes, and snippets.

@Fabaderheld
Last active September 19, 2022 07:01
Show Gist options
  • Save Fabaderheld/9ab17108bf1be139068618cc02e2a5ff to your computer and use it in GitHub Desktop.
Save Fabaderheld/9ab17108bf1be139068618cc02e2a5ff to your computer and use it in GitHub Desktop.

$GasStations = (Invoke-WebRequest -Uri "https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude=48.2505077&longitude=16.4019153&fuelType=SUP&includeClosed=false" -ContentType application/json).Content | ConvertFrom-Json | Where-Object { $_.Prices -ne $null } | Select-Object Name, Location, distance, prices

foreach ($GasStation in $GasStations) { [PSCustomObject]@{ Name = $GasStation.Name Location = $GasStation.Location.address "Distance(km)" = [System.Math]::Round($GasStation.Distance, 2) Price = $GasStation.prices.amount } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment