CFYahoo Updated

This post is more than 2 years old.

Just a quick note that I spent some time at lunch looking at my CFYahoo package. Now that Yahoo has put the ColdFusion Dev Center back up, I knew that I'd need to look at my CFCs. I created a backup of the current CFC package and took a look specifically at search support. It had changed quite a bit so I rewrote the CFC. Luckily Yahoo's APIs are still stupid-easy to use so this wasn't a big deal. I've decided to go ahead and update the release with new code for: Search and Weather. The other services will be upgraded over time. The package now requires ColdFusion 8. Just in case folks are curious - this is how easy it is to use the API:

<cfset searchAPI = createObject("component", "")>

<cfinvoke component="#searchAPI#" method="search" returnVariable="result"> <cfinvokeargument name="query" value="coldfusion blog"> </cfinvoke>

<cfdump var="#result#" label="Search for 'coldfusion blog'">

The result is a nice query you can use like any other ColdFusion query.

And here is a weather example:

<cfset weatherAPI = createObject("component", "")> <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">

And the result:

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for HERE Technologies. 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