Examples
At Xweather, we embrace learning by example. While we hope that our documentation speaks for itself, here are a few ways we can use the Phrases API endpoints.
Alerts endpoint
Request for alerts from Minneapolis, MN, using metric units only, in the personality of an radio host.
https://phrases.api.xweather.com/alerts/minneapolis, mn?stream=false&units=metric&personality=radio_host&language=en&client_id={client_id}&client_secret={client_secret}
{
"response": "Good day, listeners! It’s your favorite weather guru here, bringing you the latest updates on any active alerts in your area. I’ve got some news for you, and it looks like we’ve got a calm situation on our hands. There are no active weather alerts for Minneapolis, MN. So, sit back, relax, and enjoy this beautiful day without any weather worries!"
}
Conditions endpoint
Request for conditions and 24 hour forecast for Miami, Fl, using imperial units only, in Spanish, in the personality of a shock jock.
https://phrases.api.xweather.com/conditions/miami, fl?stream=false&units=imperial&personality=shock_jock&language=es&filter=daynight&limit=2&client_id={client_id}&client_secret={client_secret}
{
"response": "¡Hola, Miami! ¡Escuchen esto! La temperatura actual está en un agradable 76°F (24.5°C) y la humedad está al 85%, lo que significa que se siente un poco pegajoso, amigos. Con una presión de 30.06 inHg (1017.9 MB) y vientos soplando a unos 12 mph (5.5 kph) desde el sur-suroeste, la visibilidad es buena, a 9.9 millas (16 km), así que no hay excusas para no salir a disfrutar de la noche.\n\nAhora, ¿qué nos depara el futuro? Para esta noche, se espera que la temperatura baje a 72°F (22.1°C) y que se mantenga parcialmente nublado. Los vientos estarán entre 8 y 7 mph (11 y 12 kph) desde el oeste-suroeste, así que no te preocupes, no habrá tormentas en el horizonte. La probabilidad de precipitación es del 4%, así que es poco probable que te mojes. ¡Pero cuidado! Mañana por la mañana, la temperatura subirá a 78°F (25.8°C) y habrá algunas nubes con chubascos, así que prepárate para un 20% de posibilidad de lluvia. Los vientos aumentarán hasta 12 mph (20 kph) del norte, y la visibilidad seguirá siendo buena. Así que, ¡sal y disfruta de lo que la vida te ofrece, Miami! ¡Nos vemos en las olas!"
}
Impacts Endpoint
Request for current trucking impacts for Helsinki, FI, using both metric and imperial units, and reported in Finnish.
https://phrases.api.xweather.com/impacts/trucking/helsinki, fi?stream=false&units=both&personality=default&language=fi&min_severity=1&client_id={client_id}&client_secret={client_secret}
{
"response": "Helsingissä, FI, sähköajoneuvojen kantama voi olla vaarassa, koska lämpötilat vaihtelevat -10 °C:sta 0 °C:een (14 °F:sta 32 °F:een), mikä voi vähentää kantamaa jopa 40 %. Tällä hetkellä lämpötila on -7,9 °C (18 °F). Lisäksi on voimassa kohtalainen tuuli, joka alkaa 21. helmikuuta 2025 klo 13:00 ja päättyy 22. helmikuuta 2025 klo 00:00. Tuulen nopeus on 20 km/h, ja sen suunta on 180° (etelä). Trukkikuskit tulisi varautua näihin olosuhteisiin ja suunnitella reittinsä sen mukaisesti."
}