DataStax Astra DB uses the Stargate Document API to modify and query data stored asunstructured JSON documents in collections.Because the Document API uses schemaless data, no data modeling is required!
The blog https://stargate.io/2020/10/19/the-stargate-cassandra-documents-api.html[The Stargate Cassandra Documents API, window="_blank"] describes the underlying structure used to store collections.
To use the Document API, you must define the namespace that will store collections.Collections store unstructured JSON documents.Documents can themselves hold multiple documents.Multiple collections are contained in a namespace, but a collection cannot becontained in multiple namespaces.
Only namespaces need to specifically created.Collections are specified when a document is inserted.
Swagger UI for the Document API
You can access the Document API in a browser with Swagger UI at https://$ASTRACLUSTERID-$ASTRA_REGION.apps.astra.datastax.com/api/rest/swagger-ui/ .Adding parameter information, you can generate cURL commands to execute anddisplay results that will return.
Using Postman
If you prefer, you can use Postman as a client interface for exploring the Document API(download here).We've provided ahttps://raw.githubusercontent.com/stargate/docs/master/modules/developers-guide/examples/json/StargateDocumentAPIusersAstra.postman_collection.json[Stargate Document API Postman Astra Collection]that you can import in Postman to play with the examples shown in this walkthrough.
Before you get started, set your environment variables to save time developingon your database.
- In Astra, select the database to which you want to connect.
- In your Database Dashboard, select Connect.
- Select Document API.
- Follow the steps in the prerequisites to get your application token and set up your environment variables.
- In your command-line interface associated with your environment, paste the following environment variables copied for your Astra database:
- 1
Now you are ready to get started:
To view the API Reference, see Astra DB Document API.