Batching Multiple Calls into a Single Request

YQL Open Data Tables support the ability to send a list of keys in a single request, batching up what would otherwise be a multiple calls.


In order to do batching in YQL Open Data Tables, the source must support it. An example of a source that supports batching is the Yahoo Social Directory call for profiles)

Let's take the example of the Social Directory API and see the URI for profile data:

In YQL, the table for retrieving this data is social.profile. Here is an example that includes a sub-select:

When performing sub-selects, the inner sub-select returns a set of values, each of which is a call to the URI above. So if a Yahoo user has 3 connections in his profile, the sub-select makes three calls to the Social Directory API:

Fortunately, the Social Directory URI above also supports batching, so a single call can be made to get all three profiles:

Since the Social Directory API supports batching, YQL can enable this by defining the key guid as batchable with an extra parameter that denotes the max number of batch items per request:

We also need to modify the Open Table definition to support multiple values for the GUID. Combining the modification to the Open Table definition above with the one below results in a batch call to the Social Directory API for not more than 3 profiles:

Table of Contents