Gossamer Forum
Quote Reply
JSON format and Callback
GTers,

I have a few questions ... when looking at http://developer.yahoo.com/common/json.html and similar APIs, I wonder how to add such API functionality to GLinks.

?output=json
I guess making a JSON template set would do here? (then ?t=json would do the job). Now, I am using Pagebuilder, so is there another way to make such function?

Callback
Should be pretty easy to add, but how?
How about JSONP? (?output=jsonp) Does GT::JSON allow jsonp (cross-site scripts)?

John
Quote Reply
Re: [gotze] JSON format and Callback In reply to
Hi John,

Glinks now supports native/custom pages via this url page.cgi. Example, page.cgi?g=index&t=jsonp or page.cgi?p=aboutus&t=jsonp. So, in your new template, you can product json' content. You can also call global or plugins' functions in these templates.

For the callback and cross-site issues, I think it is the problem of javascript and JSON themselft, not GT::JSON. Wheneven the request reachs the above pages, the content should be produced.

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] JSON format and Callback In reply to
Hi Dat,

page.cgi: I know, but I want to set the HTTP header to application/json, which Pagebuilder allows me to. If there were a way to do so with PageBuilder, I'd use that.

callback: you may be right.

John
Quote Reply
Re: [gotze] JSON format and Callback In reply to
Hi John,

Does that require new header 'application/json'? I think just html/text or text/javascirpt is good enough. With yahoo' url like below, I use Temper Data plugin for Firefox and see just this in the response header Content-Type=text/javascript; charset=utf-8

http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Madonna&output=json

Cheers,

Dat

Programming and creating plugins and templates
Blog