Find all databases
Lists all databases.
|
You need an application token with permission to create and configure databases, such as the Organization Administrator role. For more information, see Get endpoint and token. |
Result
-
Python
-
TypeScript
-
Go
-
Java
-
C#
-
curl
Returns a list of AstraDBAdminDatabaseInfo objects that each describe a database.
Returns a promise that resolves to a list of FullDatabaseInfo objects that each describe a database.
|
The Go client is in preview. For more information, see astra-db-go. |
Returns a slice of FullAstraDatabaseInfo structs that each describe a database.
Returns a list of DatabaseInfo objects that each describe a database.
Returns a list of DatabaseInfo objects that each describe a database.
Returns 200 Success and an array of objects that each describe a database.
Example response, truncated for brevity:
[
{
"id": "DATABASE_ID",
"orgId": "organizations/ORGANIZATION_ID",
"ownerId": "users/USER_ID",
"info": {
"name": "DB_NAME",
"keyspace": "INITIAL_KEYSPACE_NAME",
"cloudProvider": "CLOUD_PROVIDER",
"region": "REGION",
"additionalKeyspaces": [
"SECOND_KEYSPACE_NAME"
],
"dbType": "vector"
},
"creationTime": "2012-11-01T22:08:41+00:00",
"terminationTime": "2019-11-01T22:08:41+00:00",
"status": "ACTIVE",
# Response truncated for brevity
}
]
Parameters
-
Python
-
TypeScript
-
Go
-
Java
-
C#
-
curl
Use the list_databases method, which belongs to the AstraDBAdmin class.
Method signature
list_databases(
*,
include: str,
provider: str,
page_size: int,
database_admin_timeout_ms: int,
request_timeout_ms: int,
timeout_ms: int,
) -> list[AstraDBAdminDatabaseInfo]
| Name | Type | Summary |
|---|---|---|
|
|
Optional. Filters the returned databases by status. Can be one of: Some of these status are short-lived or do not apply to Astra DB Serverless databases. Default: |
|
|
Optional. Filters the returned databases by cloud provider. Can be one of: Default: |
|
|
Optional. The number of results per page for the underlying API request. The client manages pagination for you and returns the full list. Maximum: 100 Default: 25 |
|
|
Optional.
A timeout, in milliseconds, to impose on each underlying API request.
If not provided, the This parameter is aliased as |
Use the listDatabases method, which belongs to the AstraAdmin class.
Method signature
async listDatabases(
options?: {
include?: AstraDatabaseStatusFilter,
provider?: AstraDatabaseCloudProviderFilter,
limit?: number,
startingAfter?: string,
timeout: number | TimeoutDescriptor,
}): AstraFullDatabaseInfo[]
| Name | Type | Summary |
|---|---|---|
|
Optional.
The options for this operation.
See Properties of |
| Name | Type | Summary |
|---|---|---|
|
Optional. Filters the returned databases by status. Can be one of: Some of these status are short-lived or do not apply to Astra DB Serverless databases. Default: |
|
|
Optional. Filters the returned databases by cloud provider. Can be one of: Default: |
|
|
|
Optional. The number of results per page. Maximum: 100 Default: 25 |
|
|
Optional. Pass the database ID of the last item on the previous page to get the next page. |
|
|
Optional. A timeout to impose on each underlying API request. |
|
The Go client is in preview. For more information, see astra-db-go. |
Use the ListDatabases method, which belongs to the AstraAdmin type.
Method signature
func (a *AstraAdmin) ListDatabases(
ctx context.Context,
opts ...options.ListDatabasesOption
) ([]FullAstraDatabaseInfo, error)
| Name | Type | Summary |
|---|---|---|
|
|
The context for the operation. |
|
Optional.
A builder to generate options for this operation.
See Methods of the |
| Method | Summary |
|---|---|
|
Optional. Filters the returned databases by status. Some database status are short-lived or do not apply to Astra DB Serverless databases. Default: |
|
Optional. Filters the returned databases by cloud provider. Default: |
|
Optional. The number of results per page. Maximum: 100 Default: 25 |
|
Optional. Pass the database ID of the last item on the previous page to get the next page. |
|
Optional. General API options for this operation, including the timeout. |
Use the listDatabases method, which belongs to the com.datastax.astra.client.admin.AstraDBAdmin class.
Method signature
List<DatabaseInfo> listDatabases()
This method does not accept any parameters.
Use the ListDatabasesAsync method, which belongs to the AstraDatabasesAdmin class.
You can also use ListDatabases, which is the synchronous version of the method.
Method signature
public Task<List<DatabaseInfo>> ListDatabasesAsync(
ListDatabaseOptions options = null
);
| Name | Type | Summary |
|---|---|---|
|
Optional.
General API options for this operation, including the timeout.
For more information and examples, see Customize API interaction.
For options specific to this method, see Method-specific properties of the |
| Name | Type | Summary |
|---|---|---|
|
|
Optional. Filters the returned databases by status. Some of the status are short-lived or do not apply to Astra DB Serverless databases. Default: |
|
|
Optional. Filters the returned databases by cloud provider. Default: |
|
|
Optional. The number of results per page. Maximum: 100 Default: 50 |
|
|
Optional. Pass the database ID of the last item on the previous page to get the next page. |
Use the DevOps API to get information about all databases in an organization.
The application token must have sufficient permissions to perform the requested operations, such as the Organization Administrator role. Additionally, the application token identifies the organization to query.
Command signature
curl -sS -L -X GET "https://api.astra.datastax.com/v2/databases?include=STRING&provider=STRING&starting_after=STRING&limit=INTEGER" \
--header "Authorization: Bearer APPLICATION_TOKEN" \
--header "Content-Type: application/json"
| Name | Type | Summary |
|---|---|---|
|
|
Optional. Filters the returned databases by status. Can be one of: Some of these status are short-lived or do not apply to Astra DB Serverless databases. Default: |
|
|
Optional. Filters the returned databases by cloud provider. Can be one of: Default: |
|
|
Optional. Pass the database ID of the last item on the previous page to get the next page. |
|
|
Optional. The number of results per page. Maximum: 100 Default: 25 |
Examples
The following examples demonstrate how to list databases.
-
Python
-
TypeScript
-
Go
-
Java
-
C#
-
curl
from astrapy import DataAPIClient
client = DataAPIClient("APPLICATION_TOKEN")
admin = client.get_admin()
databases = admin.list_databases()
print(databases)
import { DataAPIClient } from "@datastax/astra-db-ts";
const client = new DataAPIClient("APPLICATION_TOKEN");
const admin = client.admin();
(async function () {
const databases = await admin.listDatabases();
console.log(databases);
})();
|
The Go client is in preview. For more information, see astra-db-go. |
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/datastax/astra-db-go/v2/astra"
"github.com/datastax/astra-db-go/v2/astra/options"
)
func main() {
ctx := context.Background()
client := astra.NewClient(
options.API().SetToken("APPLICATION_TOKEN"),
)
admin, err := client.Admin()
if err != nil {
log.Fatal(err)
}
databases, err := admin.ListDatabases(ctx)
if err != nil {
log.Fatal(err)
}
output, err := json.Marshal(databases)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(output))
}
import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.admin.AstraDBAdmin;
import com.datastax.astra.client.databases.definition.DatabaseInfo;
import java.util.List;
public class Example {
public static void main(String[] args) {
DataAPIClient client = new DataAPIClient("APPLICATION_TOKEN");
AstraDBAdmin admin = client.getAdmin();
List<DatabaseInfo> databases = admin.listDatabases();
System.out.println(databases);
}
}
using DataStax.AstraDB.DataApi;
namespace Examples;
public class Program
{
static async Task Main()
{
var client = new DataAPIClient("APPLICATION_TOKEN");
var admin = client.GetAstraDatabasesAdmin();
var databases = await admin.ListDatabasesAsync();
}
}
curl -sS -L -X GET "https://api.astra.datastax.com/v2/databases" \
--header "Authorization: Bearer APPLICATION_TOKEN" \
--header "Content-Type: application/json"
Client reference
-
Python
-
TypeScript
-
Go
-
Java
-
C#
-
curl
For more information, see the client reference.
For more information, see the client reference.
|
The Go client is in preview. For more information, see astra-db-go. |
For more information, see the client reference.
For more information, see the client reference.
For more information, see the client reference.
Client reference documentation is not applicable for HTTP.