Similar Posts

Subscribe
Notify of
5 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Ireeb
4 months ago

As the name reveals, an API key is a key, and each key also includes a lock. Or otherwise said: A key is quite useless if there is no lock.

From this, the question is not where you get an API key, but first, which weather APIs exist and how their terms of use and, if necessary, costs look.

Because if an API requires a key to use, it means that the provider does not want everyone to simply use this API. There are public APIs that can be retrieved without key. If a key is required, this usually means that the provider at least wants to register, but as stated, the use of the API can also be associated with costs.

An API key is like a password, and each user of the API usually gets a separate key, which the provider can then disable again if necessary (e.g. if the contract has been canceled with paid APIs).

That’s why you don’t find API keys on the Internet.

The first step would be to find a suitable API. Whether you need a key, or an oAuth flow, you will find the documentation on this API.

In some cases, there are several options, so it depends on how exactly your application should work and what technologies it uses.

EmWald
4 months ago

Which provider should the API Key be? In principle, the weather data from the DWD are all public. There’s something you need to work in, but then you have access to a lot of data: https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/

EmWald
4 months ago
Reply to  Cedrik529

As I said, there is no API, but data on a server. You can only do something with them if you’re working with them. If you say what you’re about to do with it, here’s the way you could deal with to get on.

Erzesel
4 months ago

What weather service?

API keys are just your access for a paid service and does not call a place!

It goes without API keys when you use services that do not need.

I like to use https://open-meteo.com/

However, this requires a geolocation (length/width) instead of address data

However, it is possible to retrieve this for almost any address without a big excuse over the Debubgnterface from Openstreetmap. https://nominatim.openstreetmap.org/ui/about.html

here is a small Powershellscript that retrieves the current weather for my city.

#Geokoordinaten für  einen  Ort ermitteln
#Was  immer  an Adressdaten verfügbar  ist
$SearchStrings = @(
    'Leipzig'
    'Grünau'
    'Mitte'
)


$queryStrings = $SearchStrings|%{[uri]::EscapeDataString($_)}
$Query = $queryStrings -join '+'
Write-Host "QueryString: $Query" -fo  green
$ProgressPreference = 'SilentlyContinue'    # Consolefortschrittsbalken   aus
#geodaten  für "Adresse"  abfragen
$GeoCoords=(Invoke-WebRequest "https://nominatim.openstreetmap.org/search?q=$Query&format=json&addressdetails=0").content | ConvertFrom-Json
$GeoCoords #mal anshauen


#https://open-meteo.com/
#querystring  für Wetterapi basteln
$WeatherQuery=@(
    'latitude={0}'-f $GeoCoords.lat
    'longitude={0}'-f $GeoCoords.lon
    'current=temperature_2m,relative_humidity_2m,precipitation,rain,showers,snowfall,weather_code,cloud_cover,wind_speed_10m,wind_direction_10m'
)-join '&'
$WeatherQuery
#Wetterdaten  für  ermittelten Geo-Tag abrufen
$html = Invoke-WebRequest "https://api.open-meteo.com/v1/forecast?$WeatherQuery"
$Weatherobject = $html.Content|ConvertFrom-Json
$Weatherobject  #mal  angucken
$Weatherobject.Current
pause

Attention:

nominatim.openstreetmap.org/search can also deliver several results. Then, of course, the bastion of the query for the weather service.

I left a selection to make the demo unnecessarily complicated.

(before make sure that the Query only delivers a geocoordinate or can find an active selection)