-
Notifications
You must be signed in to change notification settings - Fork 10
Rest API
AstraClient
andStargate
initializations have been detailed on the Home page. Moving forward the sample code will reuse those classes but do not initialized them.
The Stargate REST API provides CRUD operations on top of Cassandra objects (tables, UDT, records). It was implemented to create an stateless absraction layer on top of Cassandra Query Language (CQL)
Related Api Reference documentation and endpoints can be found there
Class ApiDataClient
is the core class to work with Rest DATA. There are multiple ways to retrieve or initialize it.
// Option1. Given an astraClient
ApiDataClient client1 = astraClient.apiStargateData();
ApiDataClient client2 = astraClient.getStargateClient().apiRest();
// Option 2. Given a StargateClient
ApiDataClient client3 = stargateClient.apiRest();
// Option 3. Constructors
ApiDataClient client4_Astra = new ApiDataClient("http://api_endpoint", "apiToken");
ApiDataClient client5_Stargate = new ApiDataClient("http://api_endpoint",
new TokenProviderDefault("username", "password", "http://auth_endpoint");
From now, in another samples, we will use the variable name apiClient
as our working instance of ApiDataClient
DataApiIntegrationTest is the main unit test for this API and could be use as reference code
Stream<String> keyspaceNames = apiClient.keyspaceNames();
Stream<Keyspace> keyspaces = apiClient.keyspaces();
List Collections
Find a collections from its id
🏠 Home | Document | Rest | Native Drivers | GraphQL | gRPC | Astra Devops |