-
Notifications
You must be signed in to change notification settings - Fork 34
ListRecords
ngocnicholas edited this page Mar 30, 2017
·
1 revision
AirtableBase.ListRecords Method(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.
}
}
- AirtableBase
- AirtableRecordList
-
AirtableRecordList
<T>
1. AirtableRecord<T>
- AirtableApiException
-
AirtableApiResponse
- AirtableListRecordsResponse
- AirtableListRecordsResponse
<T>
- AirtableRetrieveRecordResponse
- AirtableRetrieveRecordResponse
<T>
- AirtableCreateUpdateReplaceRecordResponse
- AirtableCreateUpdateReplaceMultipleRecordsResponse
- AirtableDeleteRecordResponse
- AirtableCreateUpdateCommentResponse
- AirtableListCommentsResponse
- AirtableDeleteCommentResponse
- AirtableListWebhooksResponse
- AirtableListPayloadsResponse
- AirtableCreateWebhookResponse
- AirtableDeleteWebhookResponse
- AirtabeEnableWebhookNotificationsResponse
- AirtabeRefreshWebhookResponse
- CommentList
- IdFields
- PerformUpsert
- UserIdAndScopes
- Webhooks
- PayloadList
- WebhooksNotification
[Airtable]: http://www.airtable.com