I'm new to BigQuery (and to actually using Google API's whatsoever). Trying to read a table from JavaScript code, I am clueless as to how this should be accomplished, given my current experience and the state of documentation and lack of sample code that I could locate. It is a table I've already populated through Google's online console, and it can be seamlessly queried there in that online console.
Using Google's beta JavaScript library for BigQuery, my code receives the error object that follows my actual code. It fails on getting the table handle, which is required per my understanding for actually issuing a call to read the table. I'm quite sure my code is incorrect in more than one way in terms of what API calls I'm using, for the sake of getting to read a table's content.
Code
gapi.client.load('bigquery', 'v2', function() {
gapi.client.setApiKey('My Key for browser apps here...');
var request = gapi.client.bigquery.tables.get({'id': 'My-dataset-name.My-table-name'});
request.execute(function(response) {console.log(response, JSON.stringify(response, null))});
});
Result
{"code":401,"message":"Login Required","data":[{"domain":"global","reason":"required","message":"Login Required","locationType":"header","location":"Authorization"}]
I am short of deducing whether an API key ('Key for browser apps' as showing in my dashboard) is sufficient for authorizing access for reading data, as well as what is the syntax that should be used for the tables.get
directive. Given the multitude of dimensions using this for the first time presents, I doubt I'd find out how to use the API without setting my hair on fire. What is a detailed explanation for those last two points, and what would working sample code be?