Welcome, guest Sign In

The Two-Minute Tutorial

This tutorial shows you how to run YQL statements and examine the resulting data with the YQL Console.

  1. In your browser, run the YQL Console.
  2. Under "Example Queries", click "get my profile data". The console calls the YQL Web Service with the following query:

    select * from social.profile where guid=me

    This SELECT statement requests your Yahoo! profile information. The "*" indicates that all fields of the social.profile table will be returned. In the filter of the WHERE clause, the literal me is the GUID of the user currently logged in to Yahoo!.

  3. Note the XML response in the "FORMATTED VIEW" tab. The information from the social.profile table is in the results element. To get the response in JSON format, select the JSON radio button and click "TEST".
  4. In "Your YQL Statement", replace the "*" with the guid and familyName fields (columns):

    select guid, familyName from social.profile where guid=me

    Make sure that you capitalize the "N" in familyName. Unlike SQL, in YQL the field and table names are case sensitive.

  5. To run the command in "Your YQL Statement", click "Test". The data returned should be limited to the guid and familyName fields.
  6. In the console, examine the URL below "REST query":

    http://query.yahooapis.com/v1/public/yql?q=select%20guid%2C%20familyName%20from%20social.profile%20where%20guid%3Dme&format=json&callback=cbfunc

    To call the YQL Web Service, an application would call an HTTP GET method on this URL. The q parameter in the URL matches the SELECT statement displayed under "Your YQL Statement" (except that characters such as spaces are URL encoded). The "COPY URL" button copies this URL to your clipboard, so that you can paste it into the source code of an application.

  7. To view YQL's pre-defined tables, expand the "Data Tables" list on the right side of the console. You can run an example query on each of these tables by clicking the table name.
  8. Advanced: To view the description of a table, under "Data Tables", move your mouse cursor over the table name, then click "desc". On the "TREE VIEW" tab, expand these nodes: "query->result->table". The nodes under the "table" node contain information such as meta-data and search fields (input keys). For more information on input keys, see Remote Filters.

Table of Contents

Copyright © 2009 Yahoo! Inc. All rights reserved. Copyright | Privacy Policy

Help us continue to improve the Yahoo! Developer Network: Send Your Suggestions