Requires authorization
Allocate IDs for incomplete keys (useful for referencing an entity before it is inserted). Try it now .
Request
HTTP request
POST https://www.googleapis.com/datastore/v1beta2/datasets/datasetId/allocateIds
Parameters
Parameter name | Value | Description |
---|---|---|
Path parameters | ||
datasetId
|
string
|
Identifies the dataset. |
Authorization
This request requires authorization with at least one of the following scopes ( read more about authentication and authorization ).
Scope |
---|
https://www.googleapis.com/auth/datastore
|
https://www.googleapis.com/auth/userinfo.email
|
Request body
In the request body, supply data with the following structure:
{ "keys": [ { "partitionId": { "datasetId": string, "namespace": string }, "path": [ { "kind": string, "id": long, "name": string } ] } ] }
Property name | Value | Description | Notes |
---|---|---|---|
keys[]
|
list
|
A list of keys with incomplete key paths to allocate IDs for. No key may be reserved/read-only. | |
keys[].
partitionId
|
nested object
|
Entities are partitioned into subsets, currently identified by a dataset (usually implicitly specified by the project) and namespace ID. Queries are scoped to a single partition. | |
keys[].partitionId.
datasetId
|
string
|
The dataset ID. | |
keys[].partitionId.
namespace
|
string
|
The namespace. | |
keys[].
path[]
|
list
|
The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element identifies a root entity , the second element identifies a child of the root entity, the third element a child of the second entity, and so forth. The entities identified by all prefixes of the path are called the element's ancestors . An entity path is always fully complete: ALL of the entity's ancestors are required to be in the path along with the entity identifier itself. The only exception is that in some documented cases, the identifier in the last path element (for the entity) itself may be omitted. A path can never be empty. | |
keys[].path[].
kind
|
string
|
The kind of the entity. A kind matching regex "__.*__" is reserved/read-only. A kind must not contain more than 500 characters. Cannot be "". | |
keys[].path[].
id
|
long
|
The ID of the entity. Never equal to zero. Values less than zero are discouraged and will not be supported in the future. | |
keys[].path[].
name
|
string
|
The name of the entity. A name matching regex "__.*__" is reserved/read-only. A name must not be more than 500 characters. Cannot be "". |
Response
If successful, this method returns a response body with the following structure:
{ "header": { "kind": "datastore#responseHeader" }, "keys": [ { "partitionId": { "datasetId": string, "namespace": string }, "path": [ { "kind": string, "id": long, "name": string } ] } ] }
Property name | Value | Description | Notes |
---|---|---|---|
header
|
nested object
|
||
header.
kind
|
string
|
Identifies what kind of resource this is. Value: the fixed string
"datastore#responseHeader"
.
|
|
keys[]
|
list
|
The keys specified in the request (in the same order), each with its key path completed with a newly allocated ID. | |
keys[].
partitionId
|
nested object
|
Entities are partitioned into subsets, currently identified by a dataset (usually implicitly specified by the project) and namespace ID. Queries are scoped to a single partition. | |
keys[].partitionId.
datasetId
|
string
|
The dataset ID. | |
keys[].partitionId.
namespace
|
string
|
The namespace. | |
keys[].
path[]
|
list
|
The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element identifies a root entity , the second element identifies a child of the root entity, the third element a child of the second entity, and so forth. The entities identified by all prefixes of the path are called the element's ancestors . An entity path is always fully complete: ALL of the entity's ancestors are required to be in the path along with the entity identifier itself. The only exception is that in some documented cases, the identifier in the last path element (for the entity) itself may be omitted. A path can never be empty. | |
keys[].path[].
kind
|
string
|
The kind of the entity. A kind matching regex "__.*__" is reserved/read-only. A kind must not contain more than 500 characters. Cannot be "". | |
keys[].path[].
id
|
long
|
The ID of the entity. Never equal to zero. Values less than zero are discouraged and will not be supported in the future. | |
keys[].path[].
name
|
string
|
The name of the entity. A name matching regex "__.*__" is reserved/read-only. A name must not be more than 500 characters. Cannot be "". |
Try it!
Use the APIs Explorer below to call this method on live data and see the response. Alternatively, try the standalone Explorer .