deleteRecord method
Deletes a record from the specified tableName
.
id
: The ID of the record to delete.
Throws an AirtableException if the request fails.
Implementation
Future<void> deleteRecord(String tableName, String id) async {
final response = await http.delete(
Uri.parse('$_endpoint/$baseId/$tableName/$id'),
headers: {
'Authorization': 'Bearer $apiKey',
'Content-Type': 'application/json',
},
);
if (response.statusCode != 200) {
final errorBody = jsonDecode(response.body);
throw AirtableException(
message: 'Failed to delete record',
details: errorBody['error']?['message'],
);
}
}