Skip to content

Cloud Spanner API API

by googleapis.com

OAuthHTTPSAnalytics
Open documentation ↗

Overview

Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service.

Cloud Spanner API is an analytics API from googleapis.com. Requests are authenticated with OAuth. It is served over HTTPS. Its OpenAPI description documents 39 endpoints.

At a glance

Authentication
OAuth
HTTPS
Yes
CORS
Unknown
Category
Analytics
Base URL
https://spanner.googleapis.com/
Version
v1
Endpoints
39
Spec updated
2023-04-21

Make a first request

Replace the placeholders; the documentation says exactly where credentials go.

cURL
curl -X GET "https://spanner.googleapis.com/v1/DATABASE/ddl" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"
JavaScript
const response = await fetch("https://spanner.googleapis.com/v1/DATABASE/ddl", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_TOKEN",
  },
});
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    "GET",
    "https://spanner.googleapis.com/v1/DATABASE/ddl",
    headers={
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_TOKEN",
    },
    timeout=30,
)
print(response.json())

Endpoints

MethodPathWhat it does
DELETE/v1/{database}Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be retained according to their `expire_time`. Note: Cloud Spanner might co
GET/v1/{database}/ddlReturns the schema of a Cloud Spanner database as a list of formatted DDL statements. This method does not show pending schema updates, those may be queried usi
PATCH/v1/{database}/ddlUpdates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc. The returned long-running operation will have a name
GET/v1/{database}/sessionsLists all sessions in a given database.
POST/v1/{database}/sessionsCreates a new session. A session can be used to perform transactions that read and/or modify data in a Cloud Spanner database. Sessions are meant to be reused f
POST/v1/{database}/sessions:batchCreateCreates multiple new sessions. This API can be used to initialize a session cache on the clients. See https://goo.gl/TgSFN2 for best practices on session cache
GET/v1/{name}Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
PATCH/v1/{name}Updates a Cloud Spanner database. The returned long-running operation can be used to track the progress of updating the database. If the named database does not
DELETE/v1/{name}Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If th
GET/v1/{name}/scansRequest a specific scan with Database-specific data for Cloud Key Visualizer.
POST/v1/{name}:cancelStarts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the serv
GET/v1/{parent}Return available scans given a Database-specific resource name.
GET/v1/{parent}/backupOperationsLists the backup long-running operations in the given instance. A backup operation has a name of the form `projects//instances//backups//operations/`. The long-
GET/v1/{parent}/backupsLists completed and pending backups. Backups returned are ordered by `create_time` in descending order, starting from the most recent `create_time`.
POST/v1/{parent}/backupsStarts creating a new Cloud Spanner Backup. The returned backup long-running operation will have a name of the format `projects//instances//backups//operations/
POST/v1/{parent}/backups:copyStarts copying a Cloud Spanner Backup. The returned backup long-running operation will have a name of the format `projects//instances//backups//operations/` and
GET/v1/{parent}/databaseOperationsLists database longrunning-operations. A database operation has a name of the form `projects//instances//databases//operations/`. The long-running operation met
GET/v1/{parent}/databaseRolesLists Cloud Spanner database roles.
GET/v1/{parent}/databasesLists Cloud Spanner databases.
POST/v1/{parent}/databasesCreates a new Cloud Spanner database and starts to prepare it for serving. The returned long-running operation will have a name of the format `/operations/` and
POST/v1/{parent}/databases:restoreCreate a new database by restoring from a completed backup. The new database must be in the same project and in an instance with the same instance configuration
GET/v1/{parent}/instanceConfigOperationsLists the user-managed instance config long-running operations in the given project. An instance config operation has a name of the form `projects//instanceConf
GET/v1/{parent}/instanceConfigsLists the supported instance configurations for a given project.
POST/v1/{parent}/instanceConfigsCreates an instance config and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instan
GET/v1/{parent}/instancesLists all instances in the given project.
POST/v1/{parent}/instancesCreates an instance and begins preparing it to begin serving. The returned long-running operation can be used to track the progress of preparing the new instanc
POST/v1/{resource}:getIamPolicyGets the access control policy for a database or backup resource. Returns an empty policy if a database or backup exists but does not have a policy set. Authori
POST/v1/{resource}:setIamPolicySets the access control policy on a database or backup resource. Replaces any existing policy. Authorization requires `spanner.databases.setIamPolicy` permissio
POST/v1/{resource}:testIamPermissionsReturns permissions that the caller has on the specified database or backup resource. Attempting this RPC on a non-existent Cloud Spanner database will result i
POST/v1/{session}:beginTransactionBegins a new transaction. This step can often be skipped: Read, ExecuteSql and Commit can begin a new transaction as a side-effect.
POST/v1/{session}:commitCommits a transaction. The request includes the mutations to be applied to rows in the database. `Commit` might return an `ABORTED` error. This can occur at any
POST/v1/{session}:executeBatchDmlExecutes a batch of SQL DML statements. This method allows many statements to be run with lower latency than submitting them sequentially with ExecuteSql. State
POST/v1/{session}:executeSqlExecutes an SQL statement, returning all results in a single reply. This method cannot be used to return a result set larger than 10 MiB; if the query yields mo
POST/v1/{session}:executeStreamingSqlLike ExecuteSql, except returns the result set as a stream. Unlike ExecuteSql, there is no limit on the size of the returned result set. However, no individual
POST/v1/{session}:partitionQueryCreates a set of partition tokens that can be used to execute a query operation in parallel. Each of the returned partition tokens can be used by ExecuteStreami
POST/v1/{session}:partitionReadCreates a set of partition tokens that can be used to execute a read operation in parallel. Each of the returned partition tokens can be used by StreamingRead t
POST/v1/{session}:readReads rows from the database using key lookups and scans, as a simple key/value style alternative to ExecuteSql. This method cannot be used to return a result s
POST/v1/{session}:rollbackRolls back a transaction, releasing any locks it holds. It is a good idea to call this for any transaction that includes one or more Read or ExecuteSql requests
POST/v1/{session}:streamingReadLike Read, except returns the result set as a stream. Unlike Read, there is no limit on the size of the returned result set. However, no individual row in the r

Questions

Does the Cloud Spanner API API need an API key?

Yes. The Cloud Spanner API API uses OAuth authentication; the documentation explains how to get credentials.

Does the Cloud Spanner API API support HTTPS?

Yes, the Cloud Spanner API API is served over HTTPS.

How many endpoints does the Cloud Spanner API API have?

Its OpenAPI description lists 39 endpoints in version v1. All of them are shown on this page.

What are alternatives to the Cloud Spanner API API?

Other Analytics APIs include Google Play Integrity API, versionhistory.googleapis.com API, Doc Converter, Perspective Comment Analyzer API, Safe Browsing API.

Compare alternatives →

Google Play Integrity API

Analytics

The Play Integrity API helps you check that you're interacting with your genuine app on a genuine Android device powered by Google Play services. The Play Integrity API has replaced SafetyNet Attestation and Android Device Verification.

OAuth1 endpoints

versionhistory.googleapis.com API

Analytics

Version History API - Prod

No auth4 endpoints

Doc Converter

Analytics

This api converts file formats of OpenXml and OpenOffice documents formats to vector files (e.g., svg)

No auth1 endpoints

Perspective Comment Analyzer API

Analytics

The Perspective Comment Analyzer API provides information about the potential impact of a comment on a conversation (e.g. it can provide a score for the "toxicity" of a comment). Users can leverage the "SuggestCommentScore" method to submit corrections to improve Perspective over time. Users can set the "doNotStore" flag to ensure that all submitted comments are automatically deleted after scores are returned.

OAuth2 endpoints

Safe Browsing API

Analytics

Enables client applications to check web resources (most commonly URLs) against Google-generated lists of unsafe web resources. The Safe Browsing APIs are for non-commercial use only. If you need to use APIs to detect malicious URLs for commercial purposes – meaning “for sale or revenue-generating purposes” – please refer to the Web Risk API.

No auth7 endpoints

Web Fonts Developer API

Analytics

The Google Web Fonts Developer API lets you retrieve information about web fonts served by Google.

No auth1 endpoints

Listed from APIs.guru (CC0).