api:documentation:http:apis:start
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
— | api:documentation:http:apis:start [2024/08/31 10:03] (aktuell) – angelegt - Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Sammlung freier Online-APIs ====== | ||
+ | |||
+ | ===== Wetterdaten vom DWD (Deutscher Wetterdienst) ===== | ||
+ | <WRAP center round info 60%> | ||
+ | Auf [[https:// | ||
+ | Sehr empfehlenswert! | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | <script type=" | ||
+ | HttpClient client = new HttpClient(); | ||
+ | // Wetter in Manching | ||
+ | |||
+ | HttpRequest request = new HttpRequest().uri(" | ||
+ | |||
+ | HttpResponse response = client.send(request); | ||
+ | |||
+ | JsonElement main = JsonParser.parse(response.body()); | ||
+ | |||
+ | JsonElement hourly = main.getAttributeValue(" | ||
+ | |||
+ | JsonElement time = hourly.getAttributeValue(" | ||
+ | JsonElement temperature = hourly.getAttributeValue(" | ||
+ | |||
+ | for (int i = 0; i < time.getArrayValues().length; | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Wetterdaten der Sense-Boxes ===== | ||
+ | <WRAP center round info 60%> | ||
+ | Auf [[https:// | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | <script type=" | ||
+ | HttpClient client = new HttpClient(); | ||
+ | // Daten der Wetterstation in Hög: 5cc0a0618350e1001a6aa8ce | ||
+ | |||
+ | HttpRequest request = new HttpRequest().uri(" | ||
+ | |||
+ | HttpResponse response = client.send(request); | ||
+ | |||
+ | JsonElement main = JsonParser.parse(response.body()); | ||
+ | |||
+ | println(" | ||
+ | JsonElement sensors = main.getAttributeValue(" | ||
+ | |||
+ | for (var sensor : sensors.getArrayValues()) { | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Philips Hue-API ===== | ||
+ | Auf [[https:// | ||
+ | ===== Feiertage-API ===== | ||
+ | Auf [[https:// | ||
+ | < | ||
+ | <div class=" | ||
+ | <script type=" | ||
+ | HttpClient client = new HttpClient(); | ||
+ | // Daten zum 10. Spieltag in der 1. Bundesliga 2022 | ||
+ | HttpRequest request = new HttpRequest().uri(" | ||
+ | |||
+ | HttpResponse response = client.send(request); | ||
+ | // println(response.body()); | ||
+ | |||
+ | JsonElement main = JsonParser.parse(response.body()); | ||
+ | String[] länder = main.getAttributeIdentifiers(); | ||
+ | for (String land : länder) { | ||
+ | | ||
+ | | ||
+ | | ||
+ | for (String feiertag : feiertage) { | ||
+ | JsonElement feiertagElement = landElement.getAttributeValue(feiertag); | ||
+ | String datum = feiertagElement.getAsString(" | ||
+ | print(feiertag + ": ", Color.lightblue); | ||
+ | println(datum, | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Bund.dev ===== | ||
+ | Auf [[https:// | ||
+ | * Bundestag | ||
+ | * Jobsuche | ||
+ | * Autobahnen | ||
+ | * Umwetterwarnungen | ||
+ | * usw. | ||
+ | < | ||
+ | <div class=" | ||
+ | <script type=" | ||
+ | HttpClient client = new HttpClient(); | ||
+ | // Aktuelle Verkehrsmeldungen zur A9: | ||
+ | HttpRequest request = new HttpRequest().uri(" | ||
+ | |||
+ | |||
+ | HttpResponse response = client.send(request); | ||
+ | println(response.body()); | ||
+ | |||
+ | JsonElement main = JsonParser.parse(response.body()); | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Liga-Daten (Sport) ===== | ||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | <script type=" | ||
+ | /** | ||
+ | * Liga-Daten zu verschiedenen Sportarten | ||
+ | * Quelle : https:// | ||
+ | * Beschreibung der API hier: https:// | ||
+ | * Übersicht der gespeicherten Liga-Daten nach Sportarten: https:// | ||
+ | */ | ||
+ | |||
+ | |||
+ | HttpClient client = new HttpClient(); | ||
+ | // Daten zum 10. Spieltag in der 1. Bundesliga 2022 | ||
+ | HttpRequest request = new HttpRequest().uri(" | ||
+ | |||
+ | HttpResponse response = client.send(request); | ||
+ | println(response.body()); | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Kleine spielerische APIs ===== | ||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | <script type=" | ||
+ | /** | ||
+ | * Verzeichnis mehrerer kleiner, spielerischer APIs: | ||
+ | | ||
+ | * https:// | ||
+ | */ | ||
+ | |||
+ | HttpClient client = new HttpClient(); | ||
+ | HttpRequest request = new HttpRequest(); | ||
+ | request.uri(" | ||
+ | |||
+ | HttpResponse response = client.send(request); | ||
+ | println(response.body()); | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ===== API des statistischen Bundesamtes ===== | ||
+ | Die API des statistischen Bundesamtes ist leider sehr langsam und die Zusammenstellung der Anfrageparameter sehr kryptisch. Die Daten aber wären sehr interessant. Daher hier ein Beispiel: | ||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | <script type=" | ||
+ | /** | ||
+ | * API des Statistischen Bundesamtes (leider sehr umständlich und langsam) | ||
+ | | ||
+ | * https:// | ||
+ | | ||
+ | * https:// | ||
+ | | ||
+ | * https:// | ||
+ | | ||
+ | */ | ||
+ | |||
+ | HttpClient client = new HttpClient(); | ||
+ | HttpRequest request = new HttpRequest(); | ||
+ | request.uri(" | ||
+ | |||
+ | HttpResponse response = client.send(request); | ||
+ | println(response.body()); | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ===== API der NASDAQ ===== | ||
+ | Beispielhaft für die umfangreichen, | ||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | <script type=" | ||
+ | /** | ||
+ | * https:// | ||
+ | * https:// | ||
+ | */ | ||
+ | |||
+ | HttpClient client = new HttpClient(); | ||
+ | HttpRequest request = new HttpRequest(); | ||
+ | request.uri(" | ||
+ | |||
+ | HttpResponse response = client.send(request); | ||
+ | println(response.body()); | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||