Source: site.view [edit]
Function name: instantAnswer
Arguments: question
Description: Calls Microsoft Live 2.0 Instant Answer API
Page type: webl
Render function:  
Module: global

Page source:

 
var res = [];

var msUrl = "http://api.search.live.net/xml.aspx";
var P = GetURL(msUrl, 
   [. AppId=`51FE1FCE28D59C040667FC8CCAD4224F3A6A5298`,
      Query=question,
      Sources=`InstantAnswer`,
      Version=`2.0`,
      Market=`en-us` .]);

every answer in Elem(P, `ia:InstantAnswer`) do
   var title = Text((Elem(P, `ia:Title`) inside answer)[0]) ? "none";
   var url = Text((Elem(P, `ia:Url`) inside answer)[0]) ? "none";
   var clickThroughUrl= Text((Elem(P, `ia:ClickThroughUrl`) inside answer)[0]) ? "none";
   var attribution = Text((Elem(P, `ia:Attribution`) inside answer)[0]) ? "none";
   var contentType = Text((Elem(P, `ia:ContentType`) inside answer)[0]) ? "none";
   var value = Text((Elem(P, `enc:Value`) inside answer)[0])? "I do not know";
   res = res + [ [. title=title, answer=value, attribution=attribution, url=url, 
            clickurl=clickThroughUrl, contentType=contentType .] ]

end;

res;