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 with HCD and DSE 6.9+. Apache Cassandra® databases are not supported. |
Connect with the Data API
You can view and manage the API gateways for your datacenter in the Mission Control UI.
-
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.
-
Create an API gateway for your datacenter:
-
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.
-
Select a Service Type from the list: nodePort or clusterIP.
-
NodePort service
-
ClusterIP service
A
NodePort
service exposes the gateway outside Kubernetes on all nodes through the specified port.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 serviceThe port must be in the 30000-32767 range.
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 with10.x.x.x
.Result
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-IP
column. -
Ensure the
NodePort
range (30000-32767) is open in firewall rules. -
Verify that your API gateway service is running.
A
ClusterIP
service exposes the gateway inside the Kubernetes cluster only.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) -
CONFIGURED_PORT
: Port number configured for the Data API service
You can find the project slug in the Mission Control UI breadcrumbs next to the cluster name on the cluster details page.
The generated service name is:
<GATEWAY_NAME>-data-api-cip
. -
-
Enter a Port Number, and then click Add Gateway. The port must be in the 30000-32767 range.
-
Use the Data API
Once you have connected with the Data API, refer to the HCD or DSE documentation to use the Data API: