Get started with the Data API
Mission Control lets you view Data API connection details in the UI to interact with the databases in your datacenter. On the Connect page, you can learn how to connect to the Data API and view the API documentation.
You can use the Data API to programmatically interact with your databases. You can interact with the Data API through clients or HTTP.
|
The Data API is available for DataStax Enterprise (DSE) 6.9 and later, Hyper-Converged Database (HCD), and Astra DB. Other self-managed Apache Cassandra® databases aren’t supported. |
Connect with the Data API
You can view and manage the API gateways for your datacenter in the Mission Control UI.
You can use a nodePort service or clusterIP service for your API gateways.
Create a nodePort service API gateway
A nodePort service exposes the gateway outside Kubernetes on all nodes through the specified port.
-
In the Mission Control UI navigation menu, select your project, and then select your database cluster.
-
Click Connect.
-
Click APIs to open the Active API gateways page.
-
Click Add Gateway, and then select the datacenter you want to expose using the Data API.
-
Under Replicas, enter the number of replicas. DataStax recommends a single replica for development and testing purposes and at least two replicas for production environments.
-
For Service Type, select nodePort.
-
Enter a Port Number, and then click Add Gateway. The port must be in the 30000-32767 range.
After creating the gateway, you can connect using the following URL format:
http://DNS_NAME_OR_EXTERNAL_IP_ADDRESS_OF_CLUSTER_NODE:CONFIGURED_PORT
Replace the following:
-
DNS_NAME_OR_EXTERNAL_IP_ADDRESS_OF_CLUSTER_NODE: DNS name or external IP address of a node in the Mission Control cluster -
CONFIGURED_PORT: Port number configured for the Data API service
Find the external IP address
Run the following command to get the external IP addresses of your cluster nodes:
kubectl get nodes -o wide
Use any external IP address from the EXTERNAL-IP column, not the internal IPs starting with 10.x.x.x.
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE
cluster-default-pool-12345-abcde Ready <none> 2d18h v1.32.7-gke.1079000 10.128.0.106 203.0.113.1 Container-Optimized OS
cluster-default-pool-12345-fghij Ready <none> 2d19h v1.32.7-gke.1079000 10.128.0.36 203.0.113.2 Container-Optimized OS
If you experience connection timeout errors:
-
Verify that you’re using external IP addresses from the
EXTERNAL-IPcolumn. -
Ensure the
NodePortrange (30000-32767) is open in firewall rules. -
Verify that your API gateway service is running.
Create a clusterIP service API gateway
A clusterIP service exposes the gateway inside the Kubernetes cluster only.
-
In the Mission Control UI navigation menu, select your project, and then select your database cluster.
-
Click Connect.
-
Click APIs to open the Active API gateways page.
-
Click Add Gateway, and then select the datacenter you want to expose using the Data API.
-
Under Replicas, enter the number of replicas. DataStax recommends a single replica for development and testing purposes and at least two replicas for production environments.
-
For Service Type, select clusterIP.
-
Enter a Port Number, and then click Add Gateway. The port must be in the 30000-32767 range.
After creating the gateway, you can connect using the following URL format:
http://CLUSTER_NAME-DC_NAME-data-api-cip.PROJECT_SLUG.svc:CONFIGURED_PORT
Replace the following:
-
CLUSTER_NAME: Name of the Mission Control cluster -
DC_NAME:: Name of the datacenter -
PROJECT_SLUG: Project slug (namespace name) You can find the project slug in the Mission Control UI breadcrumbs next to the cluster name on the cluster details page. -
CONFIGURED_PORT: Port number configured for the Data API service
The generated service name is: GATEWAY_NAME-data-api-cip.
Use the Data API
Once you have connected with the Data API, refer to the HCD or DSE documentation to use the Data API: