I’ve discovered something really great about YQL. You can essentially build your own web services with just a few lines of javascript, and not have to worry about your own servers getting bogged down with requests. You can also encapsulate interesting javascript functions into webservices that anyone else might want to use without having to include your javascript code.
This whole thing came about because I am wanting to build a fun little widget to add to anyone’s website. I want it to do some interesting things via javascript, but I would rather not have to force everyone to download a big library of code, plus the idea of creating a web service for a part of it appealed to me. I was reading this article by Christian Heilmann about YQL Execute, and I realized something important. You can take any set of javascript functionality you can possibly envision, and place it inside a YQL open table. You essentially get a powerful webservice that is open to others to use and expand upon.
Let’s jump to the good stuff. I created a webservice that allows you calculate RPG style “levels” given a certain base XP value, and the number of levels you want. You can also specify the starting level so you might skip having to download unnecessary information. Here’s a link to the query in the YQL Console.
Here’s another example with the optional startlevel value set.
How did I build this? It’s so dead simple I’m suprised this is not being used a lot more than it is (yet). First, go to the YQL docs. All you have to do is create an XML file on a public server using the specs that they give, set up what input values you want, and decide how you want the output to work. Debugging this was drop dead easy in the YQL console, with LOG statements and really fast iterations.
Here’s my source XML file:
I can now create a simple little page that allows you to add XP to your “character” and watch the levels increase…
It is suprisingly fun to watch that little “Level Up” bounce when you get enough XP.
Try it out and please send me feedback!

Pingback: Tweets that mention Create Your Own Webservice with JS and YQL « Triptych -- Topsy.com
Pingback: Create Your Own Webservice with JS and YQL « Triptych – js - dowiedz si? wi?cej!
Pingback: Dynamic FAQ Section with jQuery, YQL | Script ebooks
Pingback: TTMMHTM – lovely HTML5 training book, CPU in minecraft and a few games. | Christian Heilmann's blog – Wait till I come!
Pingback: SWL-Projekt » TTMMHTM – lovely HTML5 training book, CPU in minecraft and a few games.