user3447653
user3447653

Reputation: 4148

REST Api calls to google big query

I am trying to make a rest api call for google big query from the terminal. I tried with bq query which works.

bq query 'select count(*) from publicdata:samples.shakespeare'

Just wondering what is the rest end point for bq? Or is there any http rest api call for big query which can be executed from the terminal?

Something like

Get http://...//'select count(*) from publicdata:samples.shakespeare'

Any help would be greatly appreciated. Thanks.

Upvotes: 2

Views: 27540

Answers (3)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172984

Google BigQuery provides few APIs to execute query in async and sync manner

Insert Job:
POST https://www.googleapis.com/upload/bigquery/v2/projects/projectId/jobs
and
POST https://www.googleapis.com/bigquery/v2/projects/projectId/jobs

This API starts a new asynchronous job. Requires the Can View project role.

Query Job
POST https://www.googleapis.com/bigquery/v2/projects/projectId/queries

This API runs a BigQuery SQL query and returns results if the query completes within a specified timeout.

You can see more details at BigQuery API Reference

Upvotes: 3

Elliott Brossard
Elliott Brossard

Reputation: 33705

All requests should be relative to https://www.googleapis.com/bigquery/v2, per the REST reference. For the query API, for example, you would send a POST request to https://www.googleapis.com/bigquery/v2/projects/your_project_id/queries using the request body outlined as part of the jobs.query reference.

Upvotes: 1

peiiion
peiiion

Reputation: 298

From the docs:

BigQuery API Reference

This API reference is organized by resource type. Each resource type has one or more data representations and one or more methods.

You can see the API definition file listing all methods and resources at https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest

I think this is what you're looking for: https://cloud.google.com/bigquery/docs/reference/rest/v2/

Upvotes: 0

Related Questions