API-Source:
https://www.stadt-koeln.de/externe-dienste/open-data/traffic.php
and
https://www.stadt-koeln.de/leben-in-koeln/verkehr/verkehrskalender/
JSON stored locally: https://api.json-content-importer.com/extra/json/koeln-20220130-traffic.json
In Action:
Free Plugin (show the first four items)
[[jsoncontentimporter url=https://www.stadt-koeln.de/externe-dienste/open-data/traffic.php]STRASSE:AUSLASTUNG
{subloop-array:features:4}{subloop:features.attributes:-1}{NAME}: {AUSLASTUNG}
{/subloop:features.attributes}{/subloop-array:features}
[/jsoncontentimporter]]
EMPTY api-answer: No JSON received – is the API down? Check the URL you use in the shortcode!
PRO-Plugin (show only >0 values and only 6 items):
URL: https://www.stadt-koeln.de/externe-dienste/open-data/traffic.php
twig-Template:
{% set numb = 0 %}
found features: {{features| length}}<br>
{% for f in features %}
{% if (f.attributes.auslastung>0) and (numb<6) %}
{% set numb = numb + 1 %}
{{numb}}. {{f.attributes.name}}: {{f.attributes.auslastung}}<br>
{% endif %}
{% endfor %}
found features: 1131. Ost-West-Achse – Deutzer Brücke bis Innere Kanalstraße: 16
2. Riehlerstraße – Mülheimer Brücke (Schanz) bis Zoobrücke: 16
3. Siegburger Straße – A4 – Ausfahrt Poll bis Severinsbrücke: 16
4. Rheinufer – Ubierring bis Theodor-Heuss-Ring: 1
5. Dürener Straße – Gürtel bis A1 – Ausfahrt Frechen: 16
6. Olpener Straße – A4 – Ausfahrt Refrath bis A4 – Ausfahrt Merheim: 16