Monday, February 26th, 2007

Yahoo! Pipes Support in Dojo

Category: Dojo, Yahoo!

<p>“We make it easier to work with Yahoo’s services than Yahoo does.” That is what Alex believes as he announces that Dojo supports Yahoo! Pipes, which adds to the forward-thinking JSON-P style endpoints.

It’s cool and interesting to be able to call out to Pipes from your server-side web-app, but what the mashup-mad word REALLY needs is to be able to do the same thing from a browser. Despite not really being in the docs anywhere, Yahoo’s Kent Brewster points out that Pipes supports a JSON-P callback argument. Awesome!

The structure of Pipes URLs are different than every other Yahoo service (much like flickr. ugg.), so there’s no Dojo RPC for it yet, but you can easily query a pipe using dojo.io.bind and the ScriptSrcIO transport:

javascript
< view plain text >
  1. // get news results for Cometd
  2. dojo.require("dojo.io.ScriptSrcIO"); // the x-domain magic
  3. dojo.require("dojo.debug.console"); // firebug integration
  4. dojo.io.bind({
  5.   // grab this URL from the pipe you're interested in
  6.   url: "http://pipes.yahoo.com/pipes/fELaGmGz2xGtBTC3qe5lkA/run",
  7.   mimetype: "text/json",
  8.   transport: "ScriptSrcTransport",
  9.   jsonParamName: "callback”, // aha!
  10.   content: {
  11.     “render”: “json”,
  12.     “textinput1″: “cometd”
  13.   },
  14.   load: function(type, data, evt){
  15.      // log the response out to the Firebug console
  16.      dojo.require(”dojo.json”);
  17.      dojo.debug(dojo.json.serialize(arguments));
  18.   }
  19. });

Related Content:

Posted by Dion Almaer at 12:01 am
2 Comments

+++--
3.4 rating from 30 votes

2 Comments »

Comments feed TrackBack URI

I tried the following code:

// get news results for Cometd
dojo.require(”dojo.io.ScriptSrcIO”); // the x-domain magic
dojo.require(”dojo.debug.console”); // firebug integration
dojo.io.bind({
// grab this URL from the pipe you’re interested in
url: “http://pipes.yahoo.com/pipes/fELaGmGz2xGtBTC3qe5lkA/run”,
mimetype: “text/json”,
transport: “ScriptSrcTransport”,
jsonParamName: “callback”, // aha!
content: {
“_render”: “json”,
“textinput1″: “cometd”
},
load: function(type, data, evt){ dojo.require(”dojo.json”); dojo.debug(dojo.json.serialize(arguments)); }
});

But i obtain an “invalid label” error on run line 1, debugging it with firebug.
What’s wrong?

Comment by Michele Mader — February 26, 2007

Hey, thanks for the link. Pipes plus JSON-P opens up all sorts of interesting possibilities; here’s the Ajaxian feed all badged up and ready to include on the page of your choice.

Comment by Kent Brewster — February 26, 2007

Leave a comment

You must be logged in to post a comment.