Data API vector collection
Number of APIs: 9
To run Data API commands in Qodex:
In DataStax Astra Portal, create a vector-enabled Astra DB Serverless database. Wait for your database to be Active before continuing.
Define local variables here in Qodex with values specific to your vector-enabled Astra DB Serverless database. In the Data API calls here in Qodex, you'll need the appropriate values for ASTRADBAPPLICATION_TOKEN and the ASTRADBAPI_ENDPOINT.
- In Astra Portal, on your database's Overview tab, generate an Application Token; copy and use that value in an ASTRADBAPPLICATION_TOKEN local variable in Qodex.
Also in Astra Portal, copy your API Endpoint from your database's Overview tab; use that value in an ASTRADBAPI_ENDPOINT local variable in Qodex.
- An API Endpoint has this format:
https://{{ASTRADBID}}-{{ASTRADBREGION}}.apps.astra.datastax.com
- An API Endpoint has this format:
Also define local variables for an ASTRADBKEYSPACE, and an ASTRADBCOLLECTION name.
- An ASTRADBKEYSPACE example: default_keyspace, which is present by default in your vector-enabled database.
- An ASTRADBCOLLECTION example: vector_collection
In Qodex, only change the Current value of your local variables. And be sure to Save the local variable definitions.
Download and install the [Qodex app,] if you haven't already.
TIP: Notice in the Data API commands:
The fully qualified url path -- before the collection has been created, or when you want to find or delete an existing collection -- is: ASTRADBAPIENDPOINT/api/json/v1/ASTRADBKEYSPACE_
Once the collection has been created, the fully qualified url path is: ASTRADBAPIENDPOINT/api/json/v1/ASTRADBKEYSPACE/ASTRADBCOLLECTION_
After stepping through all the commands, you can reset the example data and start over by executing the final call, deleteCollection.
About local variables: Here's an example of the local Variables UI in Qodex (with redacted ID values) for a vector-enabled Astra DB Serverless database:
-
Create and find collections - findCollections POST {{ASTRA_DB_API_ENDPOINT}}/api/json/v1/{{ASTRA_DB_KEYSPACE}}
-
Insert data - insertMany documents with $vector POST {{ASTRA_DB_API_ENDPOINT}}/api/json/v1/{{ASTRA_DB_KEYSPACE}}/{{ASTRA_DB_COLLECTION}}
-
Update data - updateMany - Set element value POST {{ASTRA_DB_API_ENDPOINT}}/api/json/v1/{{ASTRA_DB_KEYSPACE}}/{{ASTRA_DB_COLLECTION}}
-
Delete data - deleteMany - delete by status POST {{ASTRA_DB_API_ENDPOINT}}/api/json/v1/{{ASTRA_DB_KEYSPACE}}/{{ASTRA_DB_COLLECTION}}
-
Delete data - deleteCollection - delete by collection name, vectorize POST {{ASTRA_DB_API_ENDPOINT}}/api/json/v1/{{ASTRA_DB_KEYSPACE}}
-
Find and modify data - findOneAndDelete with $vectorize POST {{ASTRA_DB_API_ENDPOINT}}/api/json/v1/{{ASTRA_DB_KEYSPACE}}/{{ASTRA_DB_COLLECTION}}
-
Insert data - insertMany documents with $vectorize POST {{ASTRA_DB_API_ENDPOINT}}/api/json/v1/{{ASTRA_DB_KEYSPACE}}/{{ASTRA_DB_VECTORIZE_COLLECTION}}
-
Find data - find sorted by $vectorize search, projection enabled, return similarity scores POST {{ASTRA_DB_API_ENDPOINT}}/api/json/v1/{{ASTRA_DB_KEYSPACE}}/{{ASTRA_DB_VECTORIZE_COLLECTION}}
-
Find data - find with pagingState: to get all purchases showing Page 2 results POST {{ASTRA_DB_API_ENDPOINT}}/api/json/v1/{{ASTRA_DB_KEYSPACE}}/{{ASTRA_DB_COLLECTION}}