0
votes

The Google Apps "advanced services", as explained in the docs, are just wrappers to the associated Google APIs.

So for Create dataset API

https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/insert

It takes one parameter:

project_id

It also takes a request body:

{
  "datasetReference": {
    "datasetId": "dataset_id"
  }
}

So my Google Apps script would use the following code to pass the project_id in parameter

BigQuery.Datasets.insert(project_id);

But how could I pass the following request body to BigQuery.Datasets.insert?

{
  "datasetReference": {
    "datasetId": "dataset_id"
  }
}

Thanks!

1

1 Answers

1
votes
var resource = {
  "datasetReference": {
    "datasetId": "dataset_id"
  }
};

BigQuery.Datasets.insert(resource, project)

OK. I should use the Google Apps Script auto complete feature to get the the function definition.

Note: These is no document for methods, such as BigQuery.Datasets.insert. It is based on the API reference document for the parameters, request and response. And I think the only way to get the Google Apps Script function definition is using the source editor's auto complete feature.

BigQuery.Datasets.insert's function is

BigQuery.Datasets.insert(resource, project)

And resource is the "request body".