Join 3,551 readers in helping fund MetaFilter (Hide)


Working with Javascript and Google Fusion Tables...help!
March 12, 2013 7:44 PM   Subscribe

Working on an important open gov data project to support public schools. Need to know how to grab data from a single Google Fusion table cell using javascript...And of course, we are trying to stay up all night because we launch tomorrow. Help?
posted by jeanmari to Computers & Internet (2 answers total)
 
How far along are you? Do you already have something (either using the Google APIs Client Library for JavaScript or Google Apps Script) that's successfully querying Fusion Tables in any form? Without exposing passwords or whatnot, can you share some code snippets that show where you're at? Or maybe the Fusion Table you're querying? :D
posted by Monsieur Caution at 8:08 PM on March 12, 2013


Taking my best guess at your circumstances, I suspect you're looking at doing something like this:
<script src="https://apis.google.com/js/client.js?onload=OnLoadCallback"></script>
<script type="text/javascript">
    gapi.client.load('fusiontables', 'v1', function() { console.log('loaded.'); });
    gapi.client.setApiKey('API KEY HERE');
    var restRequest = gapi.client.request({
        'path': '/fusiontables/v1/query',
        'params': {'sql': 'SELECT ...'}
    });
    restRequest.execute(function(resp) { console.log(resp); });
</script>
Where you'd then see in the console the results of the query. I have not tried this--I'm just interpreting the docs:

Getting started with the Google APIs Client Library for JavaScript
Loading an API and making a request
The Google APIs Explorer listing for Fusion Tables
Issuing SELECT statements with the Fusion Tables API
posted by Monsieur Caution at 8:33 PM on March 12, 2013


« Older So, I was a bad ex-girlfriend ...   |  How do you keep open, light-he... Newer »
This thread is closed to new comments.