Monday, 22 March 2010

The products listed above, and their associated names, icons and logos, are the intellectual property of Microsoft Corporation.
Live Search Blog Syndicate  
Bing!
Live Search -

Today, we are proud and happy to unveil to our developer community our new search brand, Bing. Bing is a powerful new Decision Engine designed to help consumers accomplish tasks and make faster, more informed decisions. For more details on Bing, check out the main Bing blog. Bing.com will be available to the world in the coming days; in the meantime visit http://www.decisionengine.com and follow us on Twitter (@Bing) for all the latest news.

So what does this mean to you? The API provides developers programmatic access to Bing, offering flexible options for building or enhancing your site or applications. You can learn more about the API here. And try your hand developing new search apps and saving money, the planet, or both in our Will Code for Green contest!

A couple of important notes:

  • All applications that worked yesterday will work today with no changes required
  • All use of the Bing API will have to reflect brand attribution by August 30th, 2009. If you are interested in using the API, please familiarize yourself with the amended terms of use.

 

-- Alessandro Catorcini, Lead Program Manager, Kiev API


View article..

How to implement search of RSS feeds
Live Search -

We have observed that it is a very frequent need to restrict a search to RSS feeds. This is possible on the Live.com homepage by using the feed: keyword in your query.

While using this operator in an API query does not work, you can achieve the same result by specifying web.filetype=feed as a parameter in the request.

...(read more)
View article..

Basics for Green
Live Search -

A while back, we published a whitepaper on MSDN that provides what we called a "tour de ease" of some basic API features. Subsequently, some of you have requested that we offer this useful doc in a more portable format, so - voila! It's done and downloadable at our Developer Center from the API Basics link in the "Useful Resources." Click it, download it, develop an app or two with it.

One of the most satisfying aspects of managing the Live Search API is helping our team expand the already-rich diversity of programming opportunities that our multiple protocols and SourceTypes provide. This particular paper illustrates how you can leverage the appropriate combination of these protocols and SourceTypes to create applications that grow your business, yet enable you to code at the level of complexity with which you're comfortable.

Beyond growing your business, the new Will Code for Green contest offers you incentives to put the API to broader uses. Five developers will take home cash from this contest - will one of them be you? The contest runs until August 12 - use the whitepaper to get started today!

-- Alessandro Catorcini, Lead Program Manager, Live Search API


View article..

Coding for Green
Live Search - The Live Search team has announced a contest that enables you to compete with other developers for thousands of dollars in prizes. The idea: Use the Live Search API to create apps that either (1) Help people deal with the worsening economy, or (2) Improve the ecology of the planet. For details, see Will You Code for Green This Spring? Good luck! -- The Live Search API Team...(read more)
View article..

Silk Road Power Trio: New API features, Microsoft Translator, PowerToys CodePlex Launch
Live Search -

It's spring in the northern hemisphere, and the Live Search API team is celebrating with features that grow the API and the services you can use it to provide. Our SDK was ahead of the curve: It went live on MSDN and our download center earlier last week. Whether you're getting hotter in the north or getting colder in the south, we've got new features to make your search applications better all around.

We debuted all the new features last week at MIX09 - for more on the goings-on there, see the Live Search blog. In this post, you'll find an overview of the new API features, plus a shout out to a new member of the Live Search team, Microsoft Translator, and a look at the first Live Search API PowerToys codeplex.

New API features

  • Video - public at last!
    After determined negotiations, we've achieved sufficient symbiosis with content providers to make the Video SourceType available to you with minimal restriction. You'll be able to access Video the same as you would Image, Web, and the rest of our burgeoning crop of SourceTypes.
  • MobileWeb - you asked for it.
    The second new SourceType of the spring is MobileWeb, which returns results from the increasingly growing resource of Extensible Hypertext Markup Language (XHTML), Wireless Markup Language (WML) and other mobile Web pages. Functionally, this highly-demanded SourceType gives you everything you get from the Web SourceType, its static sibling - but with content from the mobile world.
  • Image Filters
    Many developers have told us that they would benefit from a means of restricting Image SourceType results to those that have specific characteristics - for example, size, aspect, or style. The ImageRequest.Filters Property enables you to use these and more to get exactly the kind of images you want; the new Video SourceType has an analagous VideoRequest.Filters Property.

Microsoft Translator

We're happy to give a shout out to the Microsoft Translator team, which showed off great new features at MIX, such as:

  • Microsoft Translator web page widget
    The Microsoft Translator web page widget allows you to bring real-time, in-place translations to your web site. Users can see your pages in their own language, without having to go to a separate translation web site, and share your page with friends in multiple languages. You can learn more about how to use the widget, get help or interact with other website owners on the Microsoft Translator forums. 2
  • Microsoft Translator AJAX API
    The Microsoft Translator AJAX API allows you to easily integrate translation functionality into your web applications and sites. You can learn more about the API on MSDN, try out the interactive SDK or interact with other developers on the Microsoft Translator forums.

For more information, check out the Translator team's blog.

PowerToys Codeplex

And, completing this Equinox treasure trio, a PowerToy* for the Live Search API. This PowerToy consists of sample code that demonstrates the ease with which a developer can create a control that takes advantage of Live Search API capabilities, as well as the ease with which such a control can be deployed on a page.

You can see an example of such a control in the Washington on the Web section in the lower right of this outdoor-recreation-website-in-progress. The control plays a slideshow based on images returned from a query sent to the API's Image SourceType . The control is written in C#, and the aspx page can be set up at design time to use the ImageRequest.Filters Property to filter the images based on query term, size, color and style.

To get started, download the sample code from Silk Road PowerToys.

* PowerToys are Microsoft product productivity tools developed after a release. They are not an official part of the product and are not supported by Microsoft.


Happy Equinox and Happy Developing - The Live Search API Team


View article..

Using the API with Java: Download Package
Live Search - This is the final post in our series that shows how you can use the API with Java. As promised, we've packaged the instructions and code from the first two posts in the series with code and instructions for two new applications and made the package available on our download site. Thus, the package includes code and instructions for creating:
  • A console application using Java and the API's XML interface
  • A console application using Java and the API's SOAP interface
  • A search box application using Java, Java Server Pages, and the API's XML interface
  • A search box application using Java, Servlets, and the API's SOAP interface

Enjoy!

-- Roopali Kaujalgi

Progam Manager, Live Search API team


View article..

New Ubiquity commands for Live Search
Live Search -

Mark Johnson from the Powerset team has posted on the Powerset blog regarding Ubiquity commands for Powerset and highlighted some commands for Live Search as well. Ubiquity is a research project from Mozilla Labs that has a lot in common with Powerset: the goal of the project is to reinvent the user interface through natural language. Ubiquity uses a command-line interface to allow you to get tasks done quicker by typing in exactly what you want.

Powerset is excited to have written a few Ubiquity commands that you might find useful. Once you have the commands installed, you can just type in "powerset " and you'll get a full Powerset Wikipedia search of the topic you enter. As a bonus, they've also included commands from Live Search.

For example, try typing "live sean penn" to get Live Search results for Sean Penn. You can also type "live images sean penn" to get a list of images or "live xrank sean penn" to get Sean Penn's xRank answer. It was really simple to do this thanks to our new JSON API offered by Live Search.

Check out the post for more details!


View article..

Using the Live Search API Version 2.0 Beta with Java and the API's SOAP Interface
Live Search - This is the second in a series of posts that show how you can use the API with Java. This post shows how you can use Java to create a console application that sends a request to the API's SOAP interface and displays the results....(read more)
View article..

Using the API Version 2.0 Beta with Java and the API's XML interface
Live Search -

This is the first of a series of posts that show how you can use the API with Java. This post shows how you can use Java to create a console application that sends a request to the API's XML interface and displays the results. The last post in the series will include a pointer to a site from which you can download all instructions and code associated with each post in the series.

Coming next: Using the API with Java and the SOAP interface

-- Roopali

Requirements

Demonstrates

These code samples demonstrates how to:

  • Send a request to the Live Search XML interface and the Web SourceType
  • Display the Live Search response as results

To run the sample

  1. Create files named WebSample.java and APINameSpaceContext.java.
  2. Copy "File 1 Content: WebSample.java" from the section of that name in this post to WebSample.java.
  3. Copy "File 2 Content: APINameSpaceContext.java" from the section of that name in this post to APINameSpaceContext.java.
  4. In WebSample.java, substitute your AppId for Insert your AppId here.
  5. Edit your computer's PATH environment variable to include the bin directory of the JAVA installation.
  6. Compile the 2 files.
  7. Run the sample (for example, typing java WebSample from the command line in the directory containing WebSample.java).

File Content

The remainder of this post consists of the content (in the form of code) that you will copy in Steps 2 and 3 of "To Run the Sample."

File 1 Content: WebSample.java

import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;

import javax.xml.parsers.DocumentBuilderFactory;

import javax.xml.parsers.ParserConfigurationException;

import javax.xml.xpath.XPath;

import javax.xml.xpath.XPathConstants;

import javax.xml.xpath.XPathExpression;

import javax.xml.xpath.XPathExpressionException;

import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;

import org.w3c.dom.NodeList;

import org.xml.sax.SAXException;

//Live Search API 2.0 code sample demonstrating the use of the

//Web SourceType over the XML Protocol.

class WebSample

{

static XPathFactory factory = null;

static XPath xpath = null;

static XPathExpression expr = null;

public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException

{

// Build the request

String requestURL = BuildRequest();

// Send the request to the Live Search Service and get the response.

Document doc = GetResponse(requestURL);

if(doc != null)

{

// Display the response obtained from the Live Search Service.

DisplayResponse(doc);

}

}

private static String BuildRequest()

{

// Replace the following string with the AppId you received from the

// Live Search Developer Center.

String AppId = "Insert your AppId here.";

String requestString = "http://api.search.live.net/xml.aspx?"

// Common request fields (required)

+ "AppId"=" + AppId

+ "&Query=msdn blogs"

+ "&Sources=Web"

// Common request fields (optional)

+ "&Version=2.0"

+ "&Market=en-us"

+ "&Adult=Moderate"

// Web-specific request fields (optional)

+ "&Web.Count=10"

+ "&Web.Offset=0"

+ "&Web.FileType=DOC"

+ "&Web.Options=DisableHostCollapsing+DisableQueryAlterations";

return requestString;

}

private static Document GetResponse(String requestURL) throws ParserConfigurationException, SAXException, IOException

{

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

dbf.setNamespaceAware(true);

Document doc = null;

DocumentBuilder db = dbf.newDocumentBuilder();

if (db != null)

{

doc = db.parse(requestURL);

}

return doc;

}

private static void DisplayResponse(Document doc) throws XPathExpressionException

{

factory = XPathFactory.newInstance();

xpath = factory.newXPath();

xpath.setNamespaceContext(new APINameSpaceContext());

NodeList errors = (NodeList) xpath.evaluate("//api:Error",doc,XPathConstants.NODESET);

if(errors != null && errors.getLength() > 0 )

{

// There are errors in the response. Display error details.

DisplayErrors(errors);

}

else

{

DisplayResults(doc);

}

}

private static void DisplayResults(Document doc) throws XPathExpressionException

{

String version = (String)xpath.evaluate("//@Version",doc,XPathConstants.STRING);

String searchTerms = (String)xpath.evaluate("//api:SearchTerms",doc,XPathConstants.STRING);

int total = Integer.parseInt((String)xpath.evaluate("//web:Web/web:Total",doc,XPathConstants.STRING));

int offset = Integer.parseInt((String)xpath.evaluate("//web:Web/web:Offset",doc,XPathConstants.STRING));

NodeList results = (NodeList)xpath.evaluate("//web:Web/web:Results/web:WebResult",doc,XPathConstants.NODESET);

// Display the results header.

System.out.println("Live Search API Version " + version);

System.out.println("Web results for " + searchTerms);

System.out.println("Displaying " + (offset+1) + " to " + (offset + results.getLength()) + " of " + total + " results ");

System.out.println();

// Display the Web results.

StringBuilder builder = new StringBuilder();

for(int i = 0 ; i < results.getLength(); i++)

{

NodeList childNodes = results.item(i).getChildNodes();

for (int j = 0; j < childNodes.getLength(); j++)

{

if(!childNodes.item(j).getLocalName().equalsIgnoreCase("DisplayUrl"))

{

String fieldName = childNodes.item(j).getLocalName();

if(fieldName.equalsIgnoreCase("DateTime"))

{

fieldName = "Last Crawled";

}

builder.append(fieldName + ":" + childNodes.item(j).getTextContent());

builder.append("\n");

}

}

builder.append("\n");

}

System.out.println(builder.toString());

}

private static void DisplayErrors(NodeList errors)

{

System.out.println("Live Search API Errors:");

System.out.println();

for (int i = 0; i < errors.getLength(); i++)

{

NodeList childNodes = errors.item(i).getChildNodes();

for (int j = 0; j < childNodes.getLength(); j++)

{

System.out.println(childNodes.item(j).getLocalName() + ":" + childNodes.item(j).getTextContent());

}

System.out.println();

}

}

}

File 2 Content: APINameSpaceContext.java

import java.util.Iterator;

import javax.xml.XMLConstants;

import javax.xml.namespace.NamespaceContext;

// Map prefixes to Namespace URIs

public class APINameSpaceContext implements NamespaceContext

{

static final String WEB_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/web";

static final String API_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/element";

static final String SPELL_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/spell";

static final String RS_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/relatedsearch";

static final String PB_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/phonebook";

static final String MM_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/multimedia";

static final String AD_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/ads";

static final String IA_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/instantanswer";

static final String NEWS_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/news";

static final String ENCARTA_NAMESPACE = "http://schemas.microsoft.com/LiveSearch/2008/04/XML/encarta";

public String getNamespaceURI(String prefix)

{

if (prefix == null) throw new NullPointerException("Null prefix");

else if ("api".equals(prefix)) return API_NAMESPACE;

else if ("web".equals(prefix)) return WEB_NAMESPACE;

return XMLConstants.NULL_NS_URI;

}

// This method isn't necessary for XPath processing.

public String getPrefix(String uri)

{

throw new UnsupportedOperationException();

}

public Iterator<String> getPrefixes(String arg0)

{

throw new UnsupportedOperationException();

}

}


View article..

API Basics
Live Search - Yesterday we posted Introducing Live Search API Version 2.0 Beta on MSDN. This whitepaper provides a tour de ease through some basic API features......(read more)
View article..

PreviousNext
Copyright 2009. Sponsored by nsquared.   |  Terms Of Use  |  Privacy Statement
Content on this site is generated from the developer community and shared freely for your enjoyment and benefit. This site is run independently of Microsoft and does not express Microsoft's views in any way.