Download OpenAPI specification:Download
The Stargate Document API modifies and queries data stored as unstructured JSON documents in collections. See the documentation site for additional information.
Page over documents in a collection, with optional search parameters.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
where | any Examples:
A JSON blob with search filters:
|
fields | any Examples:
A JSON array representing the field names that you want to restrict the results to. |
page-size | integer <int32> [ 1 .. 20 ] Default: 3 The max number of results to return. |
page-state | boolean Cassandra page state, used for pagination on consecutive requests. |
profile | boolean Whether to include query profiling information in the response (advanced). |
raw | boolean Unwrap results. |
{- "data": [
- {
- "location": "London",
- "race": {
- "competitors": 100,
- "start_date": "2022-08-15"
}
}, - {
- "location": "Barcelona",
- "race": {
- "competitors": 30,
- "start_date": "2022-09-26"
}
}
], - "pageState": "c29tZS1leGFtcGxlLXN0YXRl"
}
Create a new document with the generated ID. If the collection does not exist, it will be created.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
ttl | integer <int32> The time-to-live (in seconds) of the document. |
profile | boolean Whether to include query profiling information in the response (advanced). |
The JSON of a document.
{- "location": "London",
- "race": {
- "competitors": 100,
- "start_date": "2022-08-15"
}
}
{- "documentId": "822dc277-9121-4791-8b01-da8154e67d5d"
}
Create multiple new documents. If the collection does not exist, it will be created.
Include the
id-path
parameter to extract the ID for each document from the document itself. Theid-path
should be given as path to the document property containing the id, for examplea.b.c.[0]
. Note that document IDs will be auto-generated in case there is noid-path
parameter defined.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
id-path | string The optional path of the ID in each document whose value will be used as the ID of the created document, if present. |
ttl | integer <int32> The time-to-live (in seconds) of the document. |
profile | boolean Whether to include query profiling information in the response (advanced). |
The JSON array of a documents for batch write.
[- {
- "location": "London",
- "race": {
- "competitors": 100,
- "start_date": "2022-08-15"
}
}, - {
- "location": "Barcelona",
- "race": {
- "competitors": 30,
- "start_date": "2022-09-26"
}
}
]
{- "documentIds": [
- "822dc277-9121-4791-8b01-da8154e67d5d, 6334dft4-9153-3642-4f32-da8154e67d5d"
]
}
Retrieve the JSON representation of a single document.
Note that in case when conditions are given using the
where
query parameter or thepage-size
query parameter is defined, the response will contain an array of sub-documents where the condition is matched. The structure of returned sub-documents will only contain the path to the field which was included in the condition. Other fields of the matched sub-document can be included using thefields
parameter. Only single field conditions are possible at the moment. Multiple conditions targeting the same field are allowed. The page size and page state parameters are only used together withwhere
and enable paging through matched sub-documents.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
where | any Examples:
A JSON blob with search filters:
|
fields | any Examples:
A JSON array representing the field names that you want to restrict the results to. |
page-size | integer <int32> >= 1 The max number of results to return. |
page-state | boolean Cassandra page state, used for pagination on consecutive requests. |
profile | boolean Whether to include query profiling information in the response (advanced). |
raw | boolean Unwrap results. |
{- "documentId": "822dc277-9121-4791-8b01-da8154e67d5d",
- "data": {
- "location": "London",
- "race": {
- "competitors": 100,
- "start_date": "2022-08-15"
}
}
}
Create or update a document with a given ID. If the collection does not exist, it will be created. If the document already exists, it will be overwritten.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
ttl | integer <int32> The time-to-live (in seconds) of the document. |
profile | boolean Whether to include query profiling information in the response (advanced). |
The JSON of a document.
{- "location": "London",
- "race": {
- "competitors": 100,
- "start_date": "2022-08-15"
}
}
{- "documentId": "822dc277-9121-4791-8b01-da8154e67d5d"
}
Delete a document with a given ID.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
profile | boolean Whether to include query profiling information in the response (advanced). |
{- "code": 400,
- "description": "Request invalid: payload not provided."
}
Patch a document with a given ID. Merges data at the root with requested data. Note that operation is not allowed if a JSON schema exist for a target collection.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
ttl-auto | boolean If set to |
profile | boolean Whether to include query profiling information in the response (advanced). |
The JSON of a patch.
{- "location": "Berlin"
}
{- "documentId": "822dc277-9121-4791-8b01-da8154e67d5d"
}
Execute a built-in function (e.g. $push
and $pop
) against the root of this document. Performance may vary.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
profile | boolean Whether to include query profiling information in the response (advanced). |
raw | boolean Unwrap results. |
The request body for executing a built-in function.
operation required | string\$pop|\$push|\$set The operation to execute |
object or null The value to use for the operation |
{- "operation": "$pop"
}
Note that data
property content depends on the executed function:
$pop
- returns the item that was popped from the array$push
- returns the complete array, including the item that was pushed{- "documentId": "822dc277-9121-4791-8b01-da8154e67d5d",
- "data": 123
}
Retrieve the JSON representation of the document at a provided path.
Note that in case when conditions are given using the
where
query parameter or thepage-size
query parameter is defined, the response will contain an array of sub-documents where the condition is matched. The structure of returned sub-documents will only contain the path to the field which was included in the condition. Other fields of the matched sub-document can be included using thefields
parameter. Only single field conditions are possible at the moment. Multiple conditions targeting the same field are allowed. The page size and page state parameters are only used together withwhere
and enable paging through matched sub-documents.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
document-path required | string The path in the JSON that you want to target. Use path delimiter |
where | any Examples:
A JSON blob with search filters:
|
fields | any Examples:
A JSON array representing the field names that you want to restrict the results to. |
page-size | integer <int32> >= 1 The max number of results to return. |
page-state | boolean Cassandra page state, used for pagination on consecutive requests. |
profile | boolean Whether to include query profiling information in the response (advanced). |
raw | boolean Unwrap results. |
Response example when using a sub-document path /race
on a document like:
{ "location": "London", "race": { "competitors": 100, "start_date": "2022-08-15" } }
{- "documentId": "822dc277-9121-4791-8b01-da8154e67d5d",
- "data": {
- "race": {
- "competitors": 100,
- "start_date": "2022-08-15"
}
}
}
Create or update a path in a document by ID. If the collection does not exist, it will be created. If data exists at the path, it will be overwritten.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
document-path required | string The path in the JSON that you want to target. Use path delimiter |
ttl-auto | boolean If set to |
profile | boolean Whether to include query profiling information in the response (advanced). |
The JSON of a sub-document.
{- "competitors": 100,
- "start_date": "2022-08-15"
}
{- "documentId": "822dc277-9121-4791-8b01-da8154e67d5d"
}
Delete the data at a path in a document by ID.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
document-path required | string The path in the JSON that you want to target. Use path delimiter |
profile | boolean Whether to include query profiling information in the response (advanced). |
{- "code": 400,
- "description": "Request invalid: payload not provided."
}
Patch data at a path in a document by ID. Merges data at the path with requested data, assumes that the data at the path is already an object. Note that operation is not allowed if a JSON schema exist for a target collection.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
document-path required | string The path in the JSON that you want to target. Use path delimiter |
ttl-auto | boolean If set to |
profile | boolean Whether to include query profiling information in the response (advanced). |
The JSON of a patch.
{- "location": "Berlin"
}
{- "documentId": "822dc277-9121-4791-8b01-da8154e67d5d"
}
Execute a built-in function (e.g. $push
and $pop
) against a value in this document. Performance may vary.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
document-id required | string The ID of the document. |
document-path required | string The path in the JSON that you want to target. Use path delimiter |
profile | boolean Whether to include query profiling information in the response (advanced). |
raw | boolean Unwrap results. |
The request body for executing a built-in function.
operation required | string\$pop|\$push|\$set The operation to execute |
object or null The value to use for the operation |
{- "operation": "$pop"
}
Note that data
property content depends on the executed function:
$pop
- returns the item that was popped from the array$push
- returns the complete array, including the item that was pushed{- "documentId": "822dc277-9121-4791-8b01-da8154e67d5d",
- "data": 123
}
Get a JSON schema from a collection.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
{- "schema": {
- "empty": true,
- "valueNode": true,
- "containerNode": true,
- "missingNode": true,
- "array": true,
- "object": true,
- "nodeType": "ARRAY",
- "pojo": true,
- "number": true,
- "integralNumber": true,
- "floatingPointNumber": true,
- "short": true,
- "int": true,
- "long": true,
- "float": true,
- "double": true,
- "bigDecimal": true,
- "bigInteger": true,
- "textual": true,
- "boolean": true,
- "null": true,
- "binary": true
}
}
Assign a JSON schema to a collection. This will erase any schema that already exists.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
The JSON schema to attach
empty | boolean |
valueNode | boolean |
containerNode | boolean |
missingNode | boolean |
array | boolean |
object | boolean |
nodeType | string (JsonNodeType) Enum: "ARRAY" "BINARY" "BOOLEAN" "MISSING" "NULL" "NUMBER" "OBJECT" "POJO" "STRING" |
pojo | boolean |
number | boolean |
integralNumber | boolean |
floatingPointNumber | boolean |
short | boolean |
int | boolean |
long | boolean |
float | boolean |
double | boolean |
bigDecimal | boolean |
bigInteger | boolean |
textual | boolean |
boolean | boolean |
null | boolean |
binary | boolean |
{
}
{- "schema": {
- "empty": true,
- "valueNode": true,
- "containerNode": true,
- "missingNode": true,
- "array": true,
- "object": true,
- "nodeType": "ARRAY",
- "pojo": true,
- "number": true,
- "integralNumber": true,
- "floatingPointNumber": true,
- "short": true,
- "int": true,
- "long": true,
- "float": true,
- "double": true,
- "bigDecimal": true,
- "bigInteger": true,
- "textual": true,
- "boolean": true,
- "null": true,
- "binary": true
}
}
List all available collections in a namespace.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
raw | boolean Unwrap results. |
{- "data": [
- {
- "name": "cycling",
- "upgradeAvailable": false,
- "upgradeType": "null"
}
]
}
Create a new empty collection in a namespace.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
name required | string\w+ The name of the collection. |
{- "name": "events"
}
{- "code": 400,
- "description": "Could not create collection events-collection, it has invalid characters. Valid characters are alphanumeric and underscores."
}
Delete a collection in a namespace.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
{- "code": 401,
- "description": "Unauthorized operation.",
- "grpcStatus": "PERMISSION_DENIED"
}
Upgrade a collection in a namespace.
WARNING: This endpoint is expected to cause some down-time for the collection you choose.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
collection required | string\w+ Example: events The name of the collection. |
raw | boolean Unwrap results. |
upgradeType required | object Value: "SAI_INDEX_UPGRADE" The upgrade type to perform. |
{- "upgradeType": "SAI_INDEX_UPGRADE"
}
{- "data": {
- "name": "cycling",
- "upgradeAvailable": false,
- "upgradeType": "null"
}
}
List all available namespaces. Note that a namespace is an equivalent to the Cassandra keyspace.
raw | boolean Unwrap results. |
{- "data": [
- {
- "name": "cycling",
- "replicas": 1,
- "datacenters": [
- {
- "name": "dc1",
- "replicas": 3
}
]
}
]
}
Create a new namespace using given replication strategy. Note that a namespace is an equivalent to the Cassandra keyspace.
Request body
name required | string\w+ The name of the namespace. |
replicas | integer or null <int32> >= 1 Default: 1 The amount of replicas to use with the |
Array of objects or null (Datacenter) The datacenters within a namespace. Only applies for those namespaces created with |
{- "name": "cycling",
- "replicas": 1
}
{- "name": "cycling",
- "replicas": 1,
- "datacenters": [
- {
- "name": "dc1",
- "replicas": 3
}
]
}
Retrieve a single namespace specification. Note that a namespace is an equivalent to the Cassandra keyspace.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
raw | boolean Unwrap results. |
{- "data": {
- "name": "cycling",
- "replicas": 1,
- "datacenters": [
- {
- "name": "dc1",
- "replicas": 3
}
]
}
}
Delete a namespace if exists. Note that a namespace is an equivalent to the Cassandra keyspace.
namespace required | string\w+ Example: cycling The namespace where the collection is located. |
{- "code": 401,
- "description": "Unauthorized operation.",
- "grpcStatus": "PERMISSION_DENIED"
}