Deleting documents and collections

Delete a document

To delete a document, send a DELETE request to /api/rest/v2/namespaces/{namespace_name}/collections/{collections_name}/{document-id}.

curl -sL \
-X DELETE --url http://$ASTRA_CLUSTER_ID-$ASTRA_REGION.apps.astra.datastax.com/api/rest/v2/namespaces/myworld/collections/fitness/{docid} \
--header "X-Cassandra-Token: $ASTRA_DB_APPLICATION_TOKEN" \
--header 'Content-Type: application/json'

To delete a document, based on a document path, send a DELETE request to /api/rest/v2/namespaces/{namespace_name}/collections/{collections_name}/{document-id}/{document-path}.

curl -sL -X  DELETE --url {base_url}{base_doc_api}/{namespace}/collections/{collection}?where=\{"id":\{"$eq":"some%2Dstuff"\}\} \
--header "X-Cassandra-Token: {auth_token}" \
--header 'Content-Type: application/json'

Delete a collection

Send a DELETE request to /api/rest/v2/schemas/namespaces/{namespace_name}/collections/{collection_name} to delete a collection. All data will be deleted along with the collection schema.

curl -sL \
-X DELETE --url {base_url}{base_doc_api}/{namespace}/collections/{collection} \
--header "X-Cassandra-Token: {auth_token}" \
--header 'Content-Type: application/json'

No results are returned to confirm the document has been deleted. To confirm your document has been deleted, use the read document command.