Aller au contenu

« Bash api » : différence entre les versions

De Marmits Wiki
 
(10 versions intermédiaires par le même utilisateur non affichées)
Ligne 7 : Ligne 7 :
==== Résumé ultra-condensé : Paris: 🌦 +17°C. ====
==== Résumé ultra-condensé : Paris: 🌦 +17°C. ====
<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
curl "wttr.in/paris?format=3&lang=fr"
curl "wttr.in/Paris?&format=3&lang=fr"
</syntaxhighlight>
</syntaxhighlight>


==== Données brutes (JSON) ====  
==== Données brutes (JSON) ====  
<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
curl "wttr.in/paris?format=j1&lang=fr"
curl "wttr.in/Paris?&format=j1&lang=fr"
</syntaxhighlight>
</syntaxhighlight>


Ligne 22 : Ligne 22 :
==== Affiche les nuits (pour + de détails). ====  
==== Affiche les nuits (pour + de détails). ====  
<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
curl "wttr.in/paris?n&lang=fr"
curl "wttr.in/Paris?&n&lang=fr"
</syntaxhighlight>
</syntaxhighlight>


Ligne 45 : Ligne 45 :
</syntaxhighlight>
</syntaxhighlight>


==== open-meteo.com ====
<syntaxhighlight lang="bash" copy>
curl -s "https://api.open-meteo.com/v1/forecast?latitude=48.85&longitude=2.35&current_weather=true" | jq '.current_weather'
</syntaxhighlight>


=== openstreetmap ===
=== Localisation ===
Recherche localisation
Recherche openstreetmap
<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
curl "https://nominatim.openstreetmap.org/search?q=Eiffel+Tower&format=json" | jq
curl "https://nominatim.openstreetmap.org/search?q=Eiffel+Tower&format=json" | jq
Ligne 58 : Ligne 62 :
</syntaxhighlight>
</syntaxhighlight>


=== Météo ===
=== JokeAPI ===
open-meteo.com
Blagues
<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
curl -s "https://api.open-meteo.com/v1/forecast?latitude=48.85&longitude=2.35&current_weather=true" | jq '.current_weather'
curl "https://v2.jokeapi.dev/joke/Any?lang=fr"
</syntaxhighlight>
</syntaxhighlight>
[[category:api]]
 
[[Catégorie:Tools]] [[category:api]]

Dernière version du 6 juin 2025 à 22:02

Météo

Par défaut (3 jours).

curl wttr.in/paris

Résumé ultra-condensé : Paris: 🌦 +17°C.

curl "wttr.in/Paris?&format=3&lang=fr"

Données brutes (JSON)

curl "wttr.in/Paris?&format=j1&lang=fr"

Météo actuelle

curl "wttr.in/paris?0&lang=fr"

Affiche les nuits (pour + de détails).

curl "wttr.in/Paris?&n&lang=fr"

Affiche en français

curl "wttr.in/paris?lang=fr&v2"

Affiche les phases de la Lune

curl wttr.in/Moon

Affiche une adresse précise avec les coordonnées GPS

curl "wttr.in/48.8566,2.3522"

Affiche un graphique détaillé

curl "wttr.in/48.8566,2.3522?format=v2"

open-meteo.com

curl -s "https://api.open-meteo.com/v1/forecast?latitude=48.85&longitude=2.35&current_weather=true" | jq '.current_weather'

Localisation

Recherche openstreetmap

curl "https://nominatim.openstreetmap.org/search?q=Eiffel+Tower&format=json" | jq

Devises

Exchange Rates

curl "https://api.exchangerate-api.com/v4/latest/EUR" | jq '.rates.USD'

JokeAPI

Blagues

curl "https://v2.jokeapi.dev/joke/Any?lang=fr"