I/U/D statements rely entirely on appropriate bindings within an Open Data Table to be
usable. Specifically, you must use an
delete bindings element. These elements help to
determine what happens with the information you pass in through a YQL statement.
Consider the following INSERT statement for shortening URLs using bit.ly:
INSERT INTO bitly.shorten (login, apiKey, longUrl) VALUES ('USERNAME', 'API_KEY', 'http://yahoo.com')
The corresponding Open Data Table for this statement follows:
To run the example, you must replace
the YQL statement with your actual bit.ly username and API key (available through your bit.ly account page).
The above Open Data Table shows one of the most basic ways to use an INSERT statement
element. It simply uses
apiKey as keys to authenticate the user, with the
longUrl as the new value passed to the bit.ly API. For more information on how the
map values are used, refer to key/value/map elements in Using Open Data Tables.
In the above example, the url element contains a URI template to aid in the construction of the URI:
Here the join operator creates a key-value pair using the variable
along with its value. This pair is preceded by the ampersand symbol (&).