Yahoo! Query Language (YQL) Guide
Chapter 1. Overview
What is YQL?
The YQL Web Service enables applications to query, filter, and combine data from different sources across the Internet. YQL statements have a SQL-like syntax, familiar to any developer with database experience. The following YQL statement, for example, retrieves a list of cat photos from Flickr:
SELECT * FROM flickr.photos.search WHERE text=”cat”
To access the YQL Web Service, a Web application can call HTTP GET, passing the YQL statement as a URL parameter, for example:
http://query.yahooapis.com/v1/public/yql?q=SELECT * FROM flickr.photos.search WHERE text=”Cat”
When it processes a query, the YQL Web Service accesses a datasource on the Internet, transforms the data, and returns the results in either XML or JSON format. YQL can access several types of datasources, including Yahoo! Web Services, other Web services, and Web content in formats such as HTML, XML,
RSS, and Atom.
Feature List
The YQL Web Service has the following features:
- Because it resembles SQL, the syntax of YQL is already familiar to many developers. YQL hides the complexity of Web service APIs by presenting data as simple tables, rows, and columns.
- YQL includes pre-defined tables for popular Yahoo! Web services such as Flickr, Social, MyBlogLog, and Search.
- YQL can access services on the Internet that output data in the following formats: HTML, XML, JSON, RSS, Atom, and microformat.
- YQL is extensible, allowing you to define Open Data Tables [28] to access datasources other than Yahoo! Web Services. This feature enables you to mash up (combine) data from multiple Web services and APIs, exposing the data as a single YQL table.
- You can choose either XML or JSON for the format [23] of the results returned by requests to YQL.
- YQL sub-selects [8] enable you to join data from disparate datasources on the Web. YQL returns the data in a structured document, with elements that resemble rows in a table.
- With YQL, you can filter [6] the data returned with an expression that is similar to the WHERE clause of SQL.
- When processing data from large tables, you can page [9] through the query results.
- The YQL Console1 enables you to run YQL statements interactively from your browser. The console includes runnable sample queries so that you can quickly learn YQL. For a quick introduction to the console, see the Two-Minute Tutorial [2].
Right-click here to download PDF version