Method: projects.instances.databases.sessions.batchCreate

Creates 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 management.

HTTP request

POST https://spanner.googleapis.com/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
database

string

Required. The database in which the new sessions are created.

Authorization requires the following IAM permission on the specified resource database:

  • spanner.sessions.create

Request body

The request body contains data with the following structure:

JSON representation
{
  "sessionTemplate": {
    object (Session)
  },
  "sessionCount": integer
}
Fields
sessionTemplate

object (Session)

Parameters to be applied to each created session.

sessionCount

integer

Required. The number of sessions to be created in this batch call. The API may return fewer than the requested number of sessions. If a specific number of sessions are desired, the client can make additional calls to sessions.batchCreate (adjusting sessionCount as necessary).

Response body

The response for sessions.batchCreate.

If successful, the response body contains data with the following structure:

JSON representation
{
  "session": [
    {
      object (Session)
    }
  ]
}
Fields
session[]

object (Session)

The freshly created sessions.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.data
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.