Dark Mode

Insert data into your tables using undefined Astra DB's REST API.

After creating a table in your keyspace, you can add rows of data.Use the link:_attachments/restv2.html#operation/addRows[Add rows] endpoint to add rows to the table you created in the last step.Use the link:_attachments/restv2.html#operation/addRows[Add rows] endpoint to add rows to the table you created in the last step.

First, let's add some data to the users table that you created.Send a POST request to /api/rest/v2/keyspaces/undefined/undefined to add data to the table.The column name/value pairs are passed in the JSON body.You must include the columns that you specified as the partition key andany clustering keys, if defined.

Notice that, unlike schema creation, data queries do not require tables in theURI, only the undefined .

Collections, tuples, and UDTs

Some data types require special handling to write the data.Examples of set , list , map , tuple , and udt are shown, using the columnschema created earlier.

SET:

LIST:

LIST of MAP:

Notice that in the list, there are two key:value pairs in curly brackets. Thosepairs are each a map, and the list has two mapped items.

TUPLE:

A tuple looks like a set or list, but has a fixed number of items in the tuple grouping.

UDT:

Inserting UDTs resembles a mix of the curly brackets of maps, and the fixed number ofitems of a tuple.