Using the Service
Getting Started: The Console
Figure 1. YQL Console Explore what YQL can do.|
The easiest way to explore what YQL can do, and to start using the service, is to
use the console (see Figure 1
). The right-hand side of the page shows the set of "built-in" tables that YQL exposes, primarily most of Yahoo!'s web services. You can enter the YQL commands into the main text area at the top of the page and the results display underneath. Click any of the table names or sample queries to cause examples to "run" in the console.
Using the Web Service
After using the console you've probably come up with a few queries that you'd like to execute from your application.
Accomplish this by sending a GET
request to one of the two YQL web service endpoints, either:
The default output is XML for both endpoints, regardless of the table source that you access. If you like, JSON can append an output parameter to the call:
In addition, the JSON response also supports JSONP to allow script includes in the browser:
Authentication and Access Control
Each table in YQL has an authentication scope required for access. Typically, this corresponds to the type of data the table exposes. Private data, like user profile information, is limited to applications that can verify they are acting on behalf of a user. Public data, like web search results, is generally accessible to any application.
Public tables are accessible through the /v1/public/yql endpoint. You access private tables
(and public tables) through the main /v1/yql endpoint, which requires that you sign the call using OAuth. The public URL has stricter rate limiting, so if you plan to use YQL heavily, we recommend you access the OAuth-protected URL.
OAuth is an open standard that enables providers of user data to share some or all of that data with an external application with the user's explicit permission. YQL (and Yahoo!) uses this standard to enable users to share their information, like their name or social network details, with third-party developers (you!).
The first step is to get a "consumer key" and
"consumer secret." This information tells Yahoo! what the application is when calls are made.
The second step, if you need it, is to get permission from the user using your application to access their private
data in Yahoo!. After you've done that, you'll have an "access token" and an "access token secret."
You can find more information here. Getting a request
signed using OAuth may seem a little daunting at first. Fortunately, there are libraries for most languages that take
care of the details for you. One of these, the Yahoo!
social SDK provides a PHP library that makes accessing YQL and other Yahoo web services easy:
See Listing 1 for an example of how to get the most of your social information from Yahoo!
YQL enables developers to easily access, combine, and filter remote data to fit their application requirements. It provides consistent and unified semantics for accessing user-specific private data and public data in Yahoo!, as well as the rest of the web. Data is returned in a normalized form.
More detailed documentation and information can be found here
To learn more about Y!OS and to see how it provides new avenues for you to reach and connect with Yahoo! users like never before, visit Yahoo!'s Open Strategy home page