Stargate REST API reference (2.0.0)

Download OpenAPI specification:Download

License: Apache 2.0

The Stargate REST API provides CRUD operations on table data managed by Stargate. Keep in mind that you will need information for the server ({databaseId} and {region}) for all of these operations.

Auth

The Auth API allows you to create an authorization token to connect to your database.

Create an authorization token

Create an authorization token.

Request Body schema: application/json
username
required
string

Username

password
required
string

Password

Responses

Request samples

Content type
application/json
{
  • "username": "cassandra",
  • "password": "cassandra"
}

Response samples

Content type
application/json
{
  • "authToken": "5c90f769-8784-499c-83f7-b764822255f1"
}

Schemas

The Schema API allows you to interact with keyspaces and tables in your database

Get all keyspaces

Retrieve all available keyspaces in the specific database.

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
{
  • "name": "users_keyspace",
  • "datacenters": [
    ]
}

Create a keyspace

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json
name
required
string

The name of the keyspace.

Array of objects (Datacenter)

The datacenters within a keyspace. Only applies for those keyspaces created with NetworkTopologyStrategy.

Responses

Request samples

Content type
application/json
{
  • "name": "users_keyspace",
  • "datacenters": [
    ]
}

Response samples

Content type
application/json
{
  • "name": "string"
}

Get a keyspace using the {keyspace-id}

path Parameters
keyspace-id
required
string

keyspace name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
{
  • "name": "users_keyspace",
  • "datacenters": [
    ]
}

Delete a keyspace

path Parameters
keyspace-id
required
string

keyspace name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Create a table

path Parameters
keyspace-id
required
string

keyspace name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json
name
required
string

Name of the table.

ifNotExists
boolean
Default: false

Determines whether to create a new table if a table with the same name exists. Attempting to create an existing table returns an error unless this option is true.

required
Array of objects (ColumnDefinition)

Definition of columns that belong to the table to be added.

required
object (PrimaryKey)

Defines a column list for the primary key. Can be either a single column, compound primary key, or composite partition key. Provide multiple columns for the partition key to define a composite partition key.

object (TableOptions)

Responses

Request samples

Content type
application/json
{
  • "name": "users",
  • "ifNotExists": true,
  • "columnDefinitions": [
    ],
  • "primaryKey": {
    },
  • "tableOptions": {
    }
}

Response samples

Content type
application/json
{
  • "name": "string"
}

Get all tables

path Parameters
keyspace-id
required
string

keyspace name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get a table

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
{
  • "name": "users",
  • "keyspace": "users_keyspace",
  • "columnDefinitions": [
    ],
  • "primaryKey": {
    },
  • "tableOptions": {
    }
}

Replace a table definition (table options only)

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json
name
required
string

Name of the table.

ifNotExists
boolean
Default: false

Determines whether to create a new table if a table with the same name exists. Attempting to create an existing table returns an error unless this option is true.

required
Array of objects (ColumnDefinition)

Definition of columns that belong to the table to be added.

required
object (PrimaryKey)

Defines a column list for the primary key. Can be either a single column, compound primary key, or composite partition key. Provide multiple columns for the partition key to define a composite partition key.

object (TableOptions)

Responses

Request samples

Content type
application/json
{
  • "name": "users",
  • "ifNotExists": true,
  • "columnDefinitions": [
    ],
  • "primaryKey": {
    },
  • "tableOptions": {
    }
}

Response samples

Content type
application/json
{
  • "name": "string"
}

Delete a table

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

List columns

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Create a column

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json
name
required
string

Name for the column, which must be unique.

typeDefinition
required
string
Enum: "ascii" "text" "varchar" "tinyint" "smallint" "int" "bigint" "varint" "decimal" "float" "double" "date" "DateRangeType" "duration" "time" "timestamp" "uuid" "timeuuid" "blob" "boolean" "counter" "inet" "PointType" "LineStringType" "PolygonType" "frozen" "list" "map" "set" "tuple"

The type of data allowed in the column.

static
boolean
Default: false

Denotes whether the column is shared by all rows of a partition.

Responses

Request samples

Content type
application/json
{
  • "name": "emailaddress",
  • "typeDefinition": "text",
  • "static": false
}

Response samples

Content type
application/json
{
  • "name": "string"
}

Get a column

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

column-id
required
string

column name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
{
  • "name": "emailaddress",
  • "typeDefinition": "text",
  • "static": false
}

Replace a column definition

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

column-id
required
string

column name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json
name
required
string

Name for the column, which must be unique.

typeDefinition
required
string
Enum: "ascii" "text" "varchar" "tinyint" "smallint" "int" "bigint" "varint" "decimal" "float" "double" "date" "DateRangeType" "duration" "time" "timestamp" "uuid" "timeuuid" "blob" "boolean" "counter" "inet" "PointType" "LineStringType" "PolygonType" "frozen" "list" "map" "set" "tuple"

The type of data allowed in the column.

static
boolean
Default: false

Denotes whether the column is shared by all rows of a partition.

Responses

Request samples

Content type
application/json
{
  • "name": "emailaddress",
  • "typeDefinition": "text",
  • "static": false
}

Response samples

Content type
application/json
{
  • "name": "string"
}

Delete a column

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

column-id
required
string

column name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

List indexes for a given table

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
[
  • [
    ]
]

Create an index

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json
name
string

Optional name for the index, which must be unique. If no name is specified, the index is named as follows: tablename_columnname_idx.

column
required
string

Column for which index will be created.

type
string
Default: ""
Enum: "org.apache.cassandra.index.sasi.SASIIndex" "StorageAttachedIndex"

Type of index, defined with a custom index class name or classpath. Secondary index is default, no type entered

object
kind
string
Default: "VALUES"
Enum: "FULL" "KEYS" "VALUES" "ENTRIES"

Index kind for collections.

ifNotExists
boolean
Default: false

Determines creation of a new index, if an index with the same name exists. If an index exists, and this option is set to true, an error is returned.

Responses

Request samples

Content type
application/json
{
  • "name": "age_idx",
  • "column": "age",
  • "type": "",
  • "options": {
    },
  • "kind": "KEYS",
  • "ifNotExists": true
}

Response samples

Content type
application/json
{
  • "success": true
}

Delete an index

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

index-id
required
string

index name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

List types

path Parameters
keyspace-id
required
string

keyspace name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create Type

path Parameters
keyspace-id
required
string

keyspace name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json
name
required
string
ifNotExists
boolean

Determines whether to create a new UDT if an UDT with the same name exists. Attempting to create an existing UDT returns an error unless this option is true.

required
Array of objects (TypeField)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "ifNotExists": true,
  • "fields": [
    ]
}

Response samples

Content type
application/json
{
  • "name": "string"
}

Update a type

path Parameters
keyspace-id
required
string

keyspace name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json
name
required
string
Array of objects (TypeField)

Type fields to add

Array of objects (RenameTypeField)

User Defined Type fields to rename

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "addFields": [
    ],
  • "renameFields": [
    ]
}

Get a type

path Parameters
keyspace-id
required
string

keyspace name

type-id
required
string

type name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "keyspace": "string",
  • "fields": [
    ]
}

Delete a type

path Parameters
keyspace-id
required
string

keyspace name

type-id
required
string

type name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Data

The Data API allows you to add, update, and delete rows in your database

Search a table

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

query Parameters
where
object

URL escaped JSON query using the following keys:

Key Operation
$lt Less Than
$lte Less Than Or Equal To
$gt Greater Than
$gte Greater Than Or Equal To
$ne Not Equal To
$in Contained In
$exists A value is set for the key
fields
string

URL escaped, comma delimited list of keys to include

page-size
integer <int32>

restrict the number of returned items

page-state
string

move the cursor to a particular result

object (Sort)
Example: firstName=asc&age=desc

keys to sort by

raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "count": 0
}

Add rows

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json
property name*
string

Responses

Request samples

Content type
application/json
{
  • "pk": "e73c77ec-002d-457a-8b65-8ce7cfb15fc7",
  • "age": "30",
  • "name": "John"
}

Response samples

Content type
application/json
{
  • "pk": "e73c77ec-002d-457a-8b65-8ce7cfb15fc7"
}

Get a row by primary key

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

primary-key
required
string

Value from the primary key column for the table. Define composite keys by separating values with slashes (val1/val2...) in the order they were defined.
For example, if the composite key was defined as PRIMARY KEY(race_year, race_name) then the primary key in the path would be race_year/race_name

query Parameters
fields
string

URL escaped, comma delimited list of keys to include

page-size
integer <int32>

restrict the number of returned items

page-state
string

move the cursor to a particular result

object (Sort)
Example: firstName=asc&age=desc

keys to sort by

raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "count": 0
}

Replace a row by primary key

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

primary-key
required
string

Value from the primary key column for the table. Define composite keys by separating values with slashes (val1/val2...) in the order they were defined.
For example, if the composite key was defined as PRIMARY KEY(race_year, race_name) then the primary key in the path would be race_year/race_name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json

document

property name*
string

Responses

Request samples

Content type
application/json
{
  • "pk": "e73c77ec-002d-457a-8b65-8ce7cfb15fc7",
  • "age": "30",
  • "name": "John"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Update a row by primary key

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

primary-key
required
string

Value from the primary key column for the table. Define composite keys by separating values with slashes (val1/val2...) in the order they were defined.
For example, if the composite key was defined as PRIMARY KEY(race_year, race_name) then the primary key in the path would be race_year/race_name

query Parameters
raw
boolean
Default: false

Unwrap results.

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Request Body schema: application/json

document

property name*
string

Responses

Request samples

Content type
application/json
{
  • "pk": "e73c77ec-002d-457a-8b65-8ce7cfb15fc7",
  • "age": "30",
  • "name": "John"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Delete a row by primary key

path Parameters
keyspace-id
required
string

keyspace name

table-id
required
string

table name

primary-key
required
string

Value from the primary key column for the table. Define composite keys by separating values with slashes (val1/val2...) in the order they were defined.
For example, if the composite key was defined as PRIMARY KEY(race_year, race_name) then the primary key in the path would be race_year/race_name

header Parameters
X-Cassandra-Token
required
string

The token returned from the authorization endpoint. Use this token in each request.

Responses