Stargate Api Document - datastaxdevs/awesome-astra GitHub Wiki

🏠 Back to home | Written by Cedrick Lunven, Last Update 3/14/2022

📖 Reference Documentations
  1. Document API reference Blogpost
  2. Design Improvements in 2021
  3. QuickStart

Overview

The document Api is an abstraction on top of Apache Cassandra to allow document-oriented accesses. The algorithm used is called document shredding and optimized to limit tombstones on edits and deletes.

  • You would work with JSON document with no validation.

  • You can search on any field thanks to the support out of the box of the secondary index SAI

  • Data is stored in collections, that would create a technical table under the hood not mean to be queried through CQL

create table <collection_name> (
  key text,
  p0 text,
  … p[N] text,
  bool_value boolean,
  txt_value text,
  dbl_value double, 
  leaf text
)

A json like {"a": { "b": 1 }, "c": 2} will be stored like

key p0 p1 dbl_value
{docid} a b 1
{docid} c null 2

This also work with arrays {"a": { "b": 1 }, "c": [{"d": 2}]}

key p0 p1 p2 dbl_value
{docid} a b null 1
{docid} c [0] d 2

⚠️ Limitations: As of today there are no aggregations nor sorting available in the Document Api.

Working with Postman

📦. Prerequisites [ASTRA]

📦. Prerequisites [Development Environment]

  • You should install Postman to import some collections we provided.

📦. Setup Postman

  • Import the configuration File Astra_Document_Api_Configuration.json in postman. In the menu locate File > Import and drag the file in the box.

import-doc

  • Edit the values for you db:
Parameter Name parameter value Description
token AstraCS:.... When you generate a new token it is the third field. Make sure you add enough privileges to use the APis, Database Administrator is a good choice to develop
db 00000000-0000-0000-0000-00000000000 Unique identifier of your DB, you find on the main dashboard
region us-east1 region name, you find on the datanase dashboard
namespace demo Namespaces are the same as keyspaces. They are created with the database or added from the database dashboard: How to create a keyspace]
collection person Collection name (like table) to store one type of documents.
  • this is what it is look like

import-doc

  • Import the Document Api Collection Astra_Document_Api.json in postman. Same as before File > Menu

import-doc

  • That's it you have now access to a few dozens operations for namespace, collections and documents

import-doc

Working with CURL

📦. Prerequisites [ASTRA]

📦. Prerequisites [Development Environment]

  • Working with CURL:You should have curl commands available either installing following steps here or
curl --version

Working with Swagger

⚠️ **GitHub.com Fallback** ⚠️