Check keyspace existence
To check if a keyspaces exist, execute a
REST API query with cURL
to find all the keyspaces:
curl -s -L -X GET https://$ASTRA_CLUSTER_ID-$ASTRA_REGION.apps.astra.datastax.com/api/rest/v2/schemas/keyspaces \
-H "X-Cassandra-Token: $ASTRA_DB_APPLICATION_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
{
"data":[
{
"name":"system_distributed"
},
{
"name":"system"
},
{
"name":"data_endpoint_auth"
},
{
"name":"users_keyspace"
},
{
"name":"system_schema"
},
{
"name":"myworld"
},
{
"name":"stargate_system"
},
{
"name":"library"
},
{
"name":"system_auth"
},
{
"name":"system_traces"
}
]
}
To get a particular keyspace, specify the keyspace in the URL:
curl -s -L -X GET https://$ASTRA_CLUSTER_ID-$ASTRA_REGION.apps.astra.datastax.com/api/rest/v2/schemas/keyspaces/users_keyspace \
-H "X-Cassandra-Token: $ASTRA_DB_APPLICATION_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
{"data":{"name":"users_keyspace"}}