ColdFusion Yahoo Package - Second Release

I’ve attached the second release of the ColdFusion Yahoo Package. It now includes APIs for Traffic and Weather data. Here is a few examples.

Traffic

<cfset trafficAPI = createObject("component", "org.camden.yahoo.traffic")>

<cfinvoke component=”#trafficAPI#” method=”trafficSearch” returnVariable=”result”> <cfinvokeargument name=”zip” value=”90210”> </cfinvoke>

<cfdump var=”#result#” label=”Zip search for 90210”> </code>

Weather

Weather is a tiny bit more complex. It has 2 public methods. One to get the current weather and one to get the forecast.

<cfset weatherAPI = createObject("component", "org.camden.yahoo.weather")>

<cfinvoke component=”#weatherAPI#” method=”getWeather” returnVariable=”result”> <cfinvokeargument name=”location” value=”70508”> <cfinvokeargument name=”units” value=”F”> </cfinvoke>

<cfdump var=”#result#” label=”Weather for Lafayette, LA”>

<cfinvoke component=”#weatherAPI#” method=”getForecast” returnVariable=”result”> <cfinvokeargument name=”location” value=”70508”> <cfinvokeargument name=”units” value=”F”> </cfinvoke>

<cfdump var=”#result#” label=”Forecast for Lafayette, LA”> </code><p>Download attached file.</p>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments