Dark Mode

Update data in your tables using Astra's REST API.

After creating a table in your keyspace and adding rows, you can update data.Data can be replaced or partially updated. Two endpoints can be used, eitherthe link:update rows endpointor the link:replace rows endpoint.

In the REST API, adding new rows is initially done with a POST command.After a row is input, a PUT command is used to replace the row data, or a PATCH command can be can be used to replace only some of the row data.

Update data

Data changes, so often it is necessary to update an entire row.To update a row, send a PUT request to /api/rest/v2/keyspaces/undefined/undefined/undefined .The undefined is comprised of the primary key values.In this example, the partition key is firstname "Mookie" and theclustering key is lastname "Betts";thus, we use /Mookie/Betts as the undefined in our request.

Updates are upserts. If the row doesn't exist, it will be created.If it does exist, it will be updated with the new row data.

It is also possible to update only part of a row. To partially update, senda PATCH request to /api/rest/v2/keyspaces/undefined/undefined/undefined .In this example, we realize we should not have changed the email address, andwe want to only change that one column: