Delete Records
We will show you how to Delete records.
Example: delete the two records for the specified datasheet
Assuming you have a datasheet, you would like to delete two of these records.
Your action steps below:
Get your API Token.(How to get it)
Get the ID of the datasheet.(How to get it)
Gets the ID of the 2 records you want to delete.(How to get it)
Open the terminal on your computer, execute the following code and send the query request to the server (assuming datasheetId is
dstWUHwzTHd2YQaXEE
, two record Id isrecADeOmeoJHg
andrecpveDCZYO
):- cURL
- Javascript SDK
- Python SDK
curl -X DELETE \
'https://aitable.ai/fusion/v1/datasheets/dstWUHwzTHd2YQaXEE/records?recordIds=recADeOmeoJHg,recfCpveDCZYO' \
-H 'Authorization: Bearer {Your API Token}'Note: Need to Download and initialize Javascript SDK first, and then execute the following command.
import { APITable } from 'apitable';
const apitable = new APITable({
token: 'Your API Token',
});
const datasheet = apitable.datasheet("dstWUHwzTHd2YQaXEE");
datasheet.records.delete(["recADeOmeoJHg","recfCpveDCZYO"]).then(response => {
if (response.success) {
} else {
console.error(response);
}
});Note: You need to download and initialize the Python SDK first, and then execute the following command.
from apitable import Apitable
apitable = Apitable("Your API Token")
dst = apitable.datasheet("dstWUHwzTHd2YQaXEE")
# Delete a single record
record = dst.records.get(nickname="Anan")
record.delete()
# Delete the batch of records matching the query criteria
dst.records.filter(weight="90 kg").delete()
# Delete a record by recordId
dst.delete_records([
"recADeOmeoJHg",
"recfCpveDCZYO"
])The server returns the following JSON data, below the
"views"
is all data in this view:For the meaning of each parameter in the response, please check the API Reference
{
"success": true,
"code": 200,
"message": "SUCCESS",
"data": true
}