Delete a row (HTTP)
|
For details about additional languages, see: |
Finds a single row in a table using filter clauses, and then deletes that row.
Deleting rows produces tombstones. Excessive tombstones can impact query performance.
For general information about working with tables and rows, see About tables with the Data API (HTTP).
|
Ready to write code? See the examples for this method to get started. |
Result
Deletes a row that matches the specified parameters. If no rows match the specified parameters, this method does not delete any rows.
Always returns a status.deletedCount of -1, regardless of whether a row was found and deleted.
Example response:
{
"status": {
"deletedCount": -1
}
}
Signature
Use the deleteOne command.
curl -sS -L -X POST "API_ENDPOINT/api/json/v1/KEYSPACE_NAME/TABLE_NAME" \
--header "Token: APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"deleteOne": {
"filter": FILTER,
}
}'
Parameters
| Name | Type | Summary |
|---|---|---|
|
|
Describes the full primary key of the row to delete. For this method, the filter can only use the |
Examples
The following examples demonstrate how to delete a row in a table.
Delete a row by primary key
You can filter by primary key to find and delete a row. The filter must describe the full primary key and cannot include any other columns.
curl -sS -L -X POST "API_ENDPOINT/api/json/v1/KEYSPACE_NAME/TABLE_NAME" \
--header "Token: APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"deleteOne": {
"filter": {
"title": "Hidden Shadows of the Past",
"author": "John Anthony"
}
}
}'