-
Notifications
You must be signed in to change notification settings - Fork 41
Home
Welcome to the AirtableApiClient wiki!
AirtableApiClient.dll Dynamic Link Library is the C# interface of Airtable API client.
It provides the namespace AritableApiClient which make available many classes to the users. The AirtableBase class is by far the most important class of AirtableApiClient.
Implements all the capabilities of Airtable API client.
Namespace: AirtableApiClient
Assembly: AirtableApiClient.dll
public class AirtableBase : IDisposable
The AirtableBase type exposes the following members.
| Name | Description |
|---|---|
| public AirtableBase(string, baseId) | initializes a new instance of AirtableBase with a specific API key and a specific Base ID |
| Name | Description |
|---|---|
| ListRecords(string, string, IEnumerable, string int?, int?, IEnumerable, string) | Get a list pf records in a specific table as an asynchronous operation. |
| RetrieveRecord(string, string) | Retrieve a record with a specific id from a specific table as an asynchronous operation. |
| CreateRecord(string, Fields, bool) | Create a record in a specific table using information provided by caller as an asynchronous operation. |
| UpdateRecord(string, Fields, string, bool) | Update a record with a specific ID in a specific table as an asynchronous operation. |
| ReplaceRecord(string, Fields, string, bool) | Replace a record with a specific ID in a specific table as an asynchronous operation. |
| DeleteRecord(string, string) | Delete a record with a specific ID in a specific table as an asynchronous operation. |
| Dispose() | Releases the unmanaged resources and disposes of the managed resources used by the class |
Airtable.ListRecords(string, string, IEnumerable, string, int?, int?, IEnumerable, string)
Get a list of records in a specific table. Start the listing at a specific offset. Specify what fields should be included in the record together with a specific filter formula, the number of records per page. Specify how the record list should be sorted and from which view of the table. This method is an asynchronous operation.
Namespace: AirtableApiClient
Assembly: AirtableApiClient.dll
public async Task<AirtableListRecordsResponse> ListRecords(
string tableName,
string offset = null,
IEnumerable<string> fields = null,
string filterByFormula = null,
int? maxRecords = null,
int? pageSize = null,
IEnumerable<Sort> sort = null,
string view = null)
Type: string
Name of the table of which the records to be retrieved from
Type: string
offset into the table where the record listing starts
Type: Fields
Type: string
Type: int
Type int
Type: Sort
Type: string
The task object representing the asynchronous operation.
This operation will not block. The returned task object will complete once the entire response including content is read.
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;
string offset = null;
string errorMessage = null;
var records = new List<AirtableRecord>();
try
{
using (AirtableBase airtableBase = new AirtableBase(appKey, baseId))
{
//
// Only use a 'do while' loop if you want to get multiple pages
// of records.
//
do
{
Task<AirtableListRecordsResponse> task = airtableBase.ListRecords(
YOUR_TABLE_NAME,
offset,
fieldsArray,
filterByFormula,
maxRecords,
pageSize,
sort,
view);
AirtableListRecordsResponse response = await task;
if (response.Success)
{
records.AddRange(response.Records.ToList());
offset = response.Offset;
}
else if (response.AirtableApiError is AirtableApiException)
{
errorMessage = response.AirtableApiError.ErrorMessage;
break;
}
else
{
errorMessage = "Unknown error";
break;
}
} while (offset != null);
}
}
catch (Exception e)
{
errorMessage = e.Message;
}
if (!string.IsNullOrEmpty(errorMessage))
{
// Error reporting
}
else
{
// Do something with the retrieved 'records' and the 'offset'
// for the next page of the record list.
}
}
Airtable.RetrieveRecord(string, string)
Retrieve a record with a specific ID from a specific table as an asynchronous operation.
Namespace: AirtableApiClient
Assembly: AirtableApiClient.dll
public async Task<AirtableRetrieveRecordResponse> RetrieveRecord(
string tableName,
string id)
Type: string
Name of the table of which the record to be retrieved from
Type: string
ID of the record to be retrieved.
The task object representing the asynchronous operation.
This operation will not block. The returned task object will complete once the entire response including content is read.
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<AirtableRetrieveRecordResponse> task = airtableBase.RetrieveRecord(YOR_TABLE_NAME, ID_OF_RECORD_TO_RETRIEVE);
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
}
else
{
var record = response.Record;
// Do something with your retrieved record.
// Such as getting the attachmentList of the record if you
// know the Attachment field name
var attachmentList = response.Record.GetAttachmentField(YOUR_ATTACHMENT_FIELD_NAME);
}
}
AirtableBase.CreateRecord(string, Fields, bool)
Create a record in a specific table using provided information as an asynchronous operation.
Namespace: AirtableApiClient
Assembly: AirtableApiClient.dll
public async Task<AirtableCreateUpdateReplaceRecordResponse> CreateRecord(
string tableName,
Fields fields,
bool typecast = true)
Type: string
Name of the table where the record will be created
Type: Fields
Type: bool
Enable/Disable automatic data conversion. Default to 'true'.
The task object representing the asynchronous operation.
This operation will not block. The returned task object will complete once the entire response including content is read.
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))
{
// Create Attachments list
var attachmentList = new List<AirtableAttachment>();
attachmentList.Add(new AirtableAttachment { Url = "https://upload.wikimedia.org/wikipedia/en/d/d1/Picasso_three_musicians_moma_2006.jpg" });
var fields = new Fields();
fields.AddField("Name", "Pablo Picasso");
fields.AddField("Bio", "Spanish expatriate Pablo Picasso was one of the greatest and most influential artists of the 20th century, as well as the co-creator of Cubism.");
fields.AddField("Attachments", attachmentList);
fields.AddField("On Display?", false);
Task<AirtableCreateUpdateReplaceRecordResponse> task = airtableBase.CreateRecord(tableName, fields, true);
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
}
else
{
var record = response.Record;
// Do something with your created record.
}
}
AirtableBase.UpdateRecord(string, Fields, string, bool)
Update a record in a specific table using provided information as an asynchronous operation.
Namespace: AirtableApiClient
Assembly: AirtableApiClient.dll
public async Task<AirtableCreateUpdateReplaceRecordResponse> UpdateRecord(
string tableName,
Fields fields,
string id,
bool typeCast = true)
Type: string
Name of the table where the record will be updated
Type: Fields
ID of the record to be updated.
Type: bool
Enable/Disable automatic data conversion. Default to 'true'.
The task object representing the asynchronous operation.
This operation will not block. The returned task object will complete once the entire response including content is read.
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))
{
var fields = new Fields();
fields.AddField("Name", "Pablo Picasso Updated");
fields.AddField("On Display?", true);
Task<AirtableCreateUpdateReplaceRecordResponse> task = airtableBase.UpdateRecord(tableName, fields, ID_OF_RECORD_TO_UPDATE);
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
}
else
{
var record = response.Record;
// Do something with your updated record.
}
}
AirtableBase.ReplaceRecord(string, Fields, string, bool)
Replace a record with a specific ID in a specific table using provided information as an asynchronous operation.
Namespace: AirtableApiClient
Assembly: AirtableApiClient.dll
public async Task<AirtableCreateUpdateReplaceRecordResponse> ReplaceRecord(
string tableName,
Fields fields,
string id,
bool typeCast = true)
Type: string
Name of the table where the record will be replaced with information provided by caller.
Type: Fields
ID of the record to be replaced.
Type: bool
Enable/Disable automatic data conversion. Default to 'true'.
The task object representing the asynchronous operation.
This operation will not block. The returned task object will complete once the entire response including content is read.
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))
{
var fields = new Fields();
fields.AddField("Name", "Pablo Picasso Replaced");
fields.AddField("On Display?", true);
var attachment1 = new AirtableAttachment { Url = "https://upload.wikimedia.org/wikipedia/en/d/d1/Picasso_three_musicians_moma_2006.jpg" };
var attachment2 = new AirtableAttachment { Url = "https://upload.wikimedia.org/wikipedia/en/thumb/6/6a/Pablo_Picasso%2C_1921%2C_Nous_autres_musiciens_%28Three_Musicians%29%2C_oil_on_canvas%2C_204.5_x_188.3_cm%2C_Philadelphia_Museum_of_Art.jpg/800px-Pablo_Picasso%2C_1921%2C_Nous_autres_musiciens_%28Three_Musicians%29%2C_oil_on_canvas%2C_204.5_x_188.3_cm%2C_Philadelphia_Museum_of_Art.jpg" };
var attachmentList = new List<AirtableAttachment>();
attachmentList.Add(attachment1);
attachmentList.Add(attachment1);
fields.AddField("Attachments", attachmentList);
Task<AirtableCreateUpdateReplaceRecordResponse> task = airtableBase.ReplaceRecord(tableName, fields, ID_OF_RECORD_TO_BE_REPLACED);
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
}
else
{
var record = response.Record;
// Do something with your replaced record.
}
}
AirtableBase.DeleteRecord(string, string)
Delete a record with a specific ID in a specific table as an asynchronous operation.
Namespace: AirtableApiClient
Assembly: AirtableApiClient.dll
public async Task<AirtableDeleteRecordResponse> DeleteRecord(
string tableName,
string id)
Type: string
Name of the table where the record will be deleted
ID of the record to be deleted.
The task object representing the asynchronous operation.
This operation will not block. The returned task object will complete once the entire response including content is read.
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
}
}
AirtableBase.Dispose()
Releases the unmanaged resources and disposes of the managed resources used by the class.
Namespace: AirtableApiClient
Assembly: AirtableApiClient.dll
public void Dispose()
IDisposable.Dispose()
- AirtableBase
- AirtableRecordList
-
AirtableRecordList
<T>
1. AirtableRecord<T> - AirtableUpSertRecordList
- AirtableUpSertRecordList
<T> - AirtableApiException
-
AirtableApiResponse
- AirtableGetUserIdAndScopesResponse
- AirtableListRecordsResponse
- AirtableListRecordsResponse
<T> - AirtableRetrieveRecordResponse
- AirtableRetrieveRecordResponse
<T> - AirtableCreateUpdateReplaceRecordResponse
- AirtableCreateReplaceRecordResponse
<T> - AirtableCreateReplaceMultipleRecordsResponse
<T> - AirtableCreateUpdateReplaceMultipleRecordsResponse
- AirtableDeleteRecordResponse
- AirtableCreateUpdateCommentResponse
- AirtableListCommentsResponse
- AirtableDeleteCommentResponse
- AirtableListWebhooksResponse
- AirtableListPayloadsResponse
- AirtableCreateWebhookResponse
- AirtableDeleteWebhookResponse
- AirtabeEnableWebhookNotificationsResponse
- AirtabeRefreshWebhookResponse
- AirtableListBasesResponse
- AirtableGetBaseSchemaResponse
- AirtableCreateBaseResponse
- CommentList
- IdFields
- PerformUpsert
- UserIdAndScopes
- Webhooks
- PayloadList
- WebhooksNotification
-
TableModelList
-
TableModel
- DateDependencySettings
- ViewModel
- FieldModel
-
FieldModel<TModelOptions>
- aitextfieldmodel-and-aitextmodeloptions
- AttachmentFieldModel-and-AttachmentModelOptions
- AutoNumberFieldModel
- BarcodeFieldModel
- ButtonFieldModel
- CheckboxFieldModel
- CollaboratorFieldModel
- CountFieldModel-and-CountModelOptions
- CreatedByFieldModel
- CreatedTimeFieldModel-and-CreatedTimeModelOptions
- CurrencyFieldModel
- DateFieldModel
- DateTimeFieldModel
- DurationFieldModel
- EmailFieldModel
- FormulaFieldModel--and-FormulaModelOptions
- LastModifiedByFieldModel
- LastModifiedTimeFieldModel-and-LastModifiedTimeModelOptions
- LinkToAnotherRecordFieldModel-and-LinkToAnotherRecordModelOptions
- LongTextFieldModel
- LookupFieldModel-and-LookupModelOptions
- MultipleCollaboratorFieldModel
- MultipleSelectFieldModel-and-MultipleSelectdModelOptions
- NumberFieldModel-and-NumberModelOptions
- PercentFieldModel-and-PercentModelOptions)
- PhoneFieldModel
- RatingFieldModel
- RichTextFieldModel
- RollupFieldModel-and-RollupModelOptions
- SingleLineTextFieldModel
- SingleSelectFieldModel-and-SingleSelectdModelOptions
- SyncSourceFieldModel-and-SyncSourceModelOptions
- UrlFieldModel
- UnknownFieldModel
- FieldModelExtensions
-
TableModel
-
TableConfig
-
IFieldConfig
- Field
-
FieldConfig
- AttachmentFieldConfig
- BarcodeFieldConfig
- CheckboxFieldConfig
- CollaboratorFieldConfig
- CurrencyFieldConfig
- DateFieldConfig
- DateTimeFieldConfig
- DurationFieldConfig
- EmailFieldConfig
- LinkToAnotherRecordFieldConfig-and-LinkToAnotherRecordConfigOptions
- LongTextFieldConfig
- MultipleCollaboratorFieldConfig
- MultipleSelectFieldConfig-and-MultipleSelectdConfigOptions
- NumberFieldConfig-and-NumberConfigOptions
- PercentFieldConfig-and-PercentConfigOptions
- PhoneFieldConfig
- RatingFieldConfig
- RichTextFieldConfig
- SingleLineTextFieldConfig
- SingleSelectFieldConfig-and-SingleSelectdConfigOptions
- UrlFieldConfig
-
IFieldConfig
[Airtable]: http://www.airtable.com