Skip to content

DeleteRecord

ngocnicholas edited this page Mar 30, 2017 · 1 revision

AirtableBase.DeleteRecord Method(string, Fields, string, bool)

Delete a record with a specific ID in a specific table as an asynchronous operation.

Namespace: AirtableApiClient

Assembly: AirtableApiClient.dll

Syntax

        public async Task<AirtableDeleteRecordResponse> DeleteRecord(
            string tableName,
            string id)

Parameters

tableName

Type: string   
Name of the table where the record will be deleted

id

ID of the record to be deleted.

Return Value

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned task object will complete once the entire response including content is read.

Example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AirtableApiClient;

        readonly string baseId = YOUR_BASE_ID;
        readonly string appKey = YOUR_APP_KEY;  

        using (AirtableBase airtableBase = new AirtableBase(appKey, baseId))
        {
            Task<AirtableDeleteRecordResponse> task = airtableBase.DeleteRecord(YOUR_TABLE_NAME, ID_OF_RECORD_TO_DELETE);
            var response = await task;
            if (!response.Success)
            {
                string errorMessage = null;
                if (response.AirtableApiError is AirtableApiException)
                {
                    errorMessage = response.AirtableApiError.ErrorMessage;
                }
                else
                {
                    errorMessage = "Unknown error";
                }
                // Report errorMessage
            }
        }

Clone this wiki locally