//native
type Airtable = {
apiKey: string;
};
type AirtableTable = {
baseId: string;
tableName: string;
};
export async function main(
atCon: Airtable,
atTable: AirtableTable,
recordId: string,
) {
const url = `https://api.airtable.com/v0/${atTable.baseId}/${encodeURIComponent(
atTable.tableName,
)}/${recordId}`;
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: `Bearer ${atCon.apiKey}`,
"Content-Type": "application/x-www-form-urlencoded",
},
});
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`);
}
const deleteSingleRecord = await response.json();
return deleteSingleRecord;
}
Submitted by hugo989 14 days ago