Open Data Table Examples of I/U/D

The following Open Data Tables provide examples of INSERT:

Tip

To better understand the examples presented in this section, refer first to Using YQL Open Data Tables and Executing JavaScript in Open Data Tables.

Bit.ly Shorten URL (INSERT)

The following Open Data Table allows you to shorten a long URL into a bit.ly link.

This table showcases the following:

  • using INSERT statements
  • using value bindings

Example Statement:

INSERT INTO bitly.shorten (login, apiKey, longUrl) VALUES ('USERNAME', 'API_KEY', 'http://yahoo.com')

Open Data Table Source:

Run this example on the YQL console

Note

To run the example, you must replace USERNAME and API_KEY in the YQL statement with your actual bit.ly username and API key (available through your bit.ly account page).

WordPress Post (INSERT)

The following Open Data Table allows you to post to your WordPress blog.

This table showcases the following:

  • calling a YQL query within execute
  • allowing INSERT in addition to SELECT statements
  • performing HTTP POST with JavaScript methods
  • creating an XML response with E4X

Example Statement:

USE "http://www.datatables.org/wordpress/wordpress.post.xml"; INSERT into wordpress.post (title, description, blogurl, username, password) values ("Test Title", "This is a test body", "http://your_wordpress_blog_site.com", "your_wordpress_username", "your_wordpress_password")

Open Data Table Source:

Run this example in the YQL Console. Be sure to use your blog's URL, username, and password as values for the blogurl, username, and password keys.

Table of Contents