-
Notifications
You must be signed in to change notification settings - Fork 34
CreateRecord
ngocnicholas edited this page Mar 30, 2017
·
1 revision
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
- 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