Skip to content

ReplaceRecord

ngocnicholas edited this page Mar 30, 2017 · 1 revision

AirtableBase.ReplaceRecord Method(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

Syntax

        public async Task<AirtableCreateUpdateReplaceRecordResponse> ReplaceRecord(
            string tableName,
            Fields fields,
            string id,
            bool typeCast = true)

Parameters

tableName

Type: string   
Name of the table where the record will be replaced with information provided by caller.

fields

Type: Fields

id

ID of the record to be replaced.

typeCast

Type: bool
Enable/Disable automatic data conversion. Default to 'true'.

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))
        {
            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.
            }
        }

  1. AirtableBase
  2. AirtableRecordList
    1. AirtableRecord
      1. AirtableAttachment
        1. Thumbnails
          1. Thumbnail
      2. Fields
        1. Sort
          1. SortDirection
  3. AirtableRecordList<T>
    1. AirtableRecord<T>
  4. AirtableUpSertRecordList
  5. AirtableUpSertRecordList<T>
  6. AirtableApiException
    1. AirtableUnrecognizedException
    2. AirtableBadRequestException
    3. AirtableUnauthorizedException
    4. AirtablePaymentRequiredException
    5. AirtableForbiddenException
    6. AirtableNotFoundException
    7. AirtableRequestEntityTooLargeException
    8. AirtableInvalidRequestException
    9. AirtableTooManyRequestsException
  7. AirtableApiResponse
    1. AirtableGetUserIdAndScopesResponse
    2. AirtableListRecordsResponse
    3. AirtableListRecordsResponse<T>
    4. AirtableRetrieveRecordResponse
    5. AirtableRetrieveRecordResponse<T>
    6. AirtableCreateUpdateReplaceRecordResponse
    7. AirtableCreateReplaceRecordResponse<T>
    8. AirtableCreateReplaceMultipleRecordsResponse<T>
    9. AirtableCreateUpdateReplaceMultipleRecordsResponse
    10. AirtableDeleteRecordResponse
    11. AirtableCreateUpdateCommentResponse
    12. AirtableListCommentsResponse
    13. AirtableDeleteCommentResponse
    14. AirtableListWebhooksResponse
    15. AirtableListPayloadsResponse
    16. AirtableCreateWebhookResponse
      1. CreateWebhookResponse
    17. AirtableDeleteWebhookResponse
    18. AirtabeEnableWebhookNotificationsResponse
    19. AirtabeRefreshWebhookResponse
    20. AirtableListBasesResponse
    21. AirtableGetBaseSchemaResponse
    22. AirtableCreateBaseResponse
  8. CommentList
    1. Comment
      1. Author
      2. Mentioned
        1. MentionedEntity
  9. IdFields
  10. PerformUpsert
  11. UserIdAndScopes
  12. Webhooks
    1. Webhook
      1. WebhooksSpecification
        1. WebhooksOptions
          1. WebhooksFilters
          2. WebhooksIncludes
  13. PayloadList
    1. WebhooksPayload
  14. WebhooksNotification
  15. TableModelList
    1. TableModel
      1. DateDependencySettings
      2. ViewModel
      3. FieldModel
      4. FieldModel<TModelOptions>
        1. aitextfieldmodel-and-aitextmodeloptions
        2. AttachmentFieldModel-and-AttachmentModelOptions
        3. AutoNumberFieldModel
        4. BarcodeFieldModel
        5. ButtonFieldModel
        6. CheckboxFieldModel
          1. CheckboxModelOptions
        7. CollaboratorFieldModel
        8. CountFieldModel-and-CountModelOptions
        9. CreatedByFieldModel
        10. CreatedTimeFieldModel-and-CreatedTimeModelOptions
        11. CurrencyFieldModel
          1. CurrencyModelOptions
        12. DateFieldModel
          1. DateModelOptions
            1. DateFormat
        13. DateTimeFieldModel
          1. DateTimeModelOptions
            1. TimeFormat
        14. DurationFieldModel
          1. DurationModelOptions
        15. EmailFieldModel
        16. FormulaFieldModel--and-FormulaModelOptions
        17. LastModifiedByFieldModel
        18. LastModifiedTimeFieldModel-and-LastModifiedTimeModelOptions
        19. LinkToAnotherRecordFieldModel-and-LinkToAnotherRecordModelOptions
        20. LongTextFieldModel
        21. LookupFieldModel-and-LookupModelOptions
        22. MultipleCollaboratorFieldModel
        23. MultipleSelectFieldModel-and-MultipleSelectdModelOptions
          1. ChoiceModelOptions-and-ChoiceConfigOptions
        24. NumberFieldModel-and-NumberModelOptions
          1. PrecisionModelOptions
        25. PercentFieldModel-and-PercentModelOptions)
        26. PhoneFieldModel
        27. RatingFieldModel
          1. RatingModelOptions
        28. RichTextFieldModel
        29. RollupFieldModel-and-RollupModelOptions
        30. SingleLineTextFieldModel
        31. SingleSelectFieldModel-and-SingleSelectdModelOptions
        32. SyncSourceFieldModel-and-SyncSourceModelOptions
        33. UrlFieldModel
        34. UnknownFieldModel
    2. FieldModelExtensions
      1. TryGetOptions
      2. RequireOptions
  16. TableConfig
    1. IFieldConfig
      1. Field
      2. FieldConfig
        1. AttachmentFieldConfig
        2. BarcodeFieldConfig
        3. CheckboxFieldConfig
          1. CheckboxConfigOptions
        4. CollaboratorFieldConfig
        5. CurrencyFieldConfig
          1. CurrencyConfigOptions
        6. DateFieldConfig
          1. DateConfigOptions
        7. DateTimeFieldConfig
          1. DateTimeConfigOptions
        8. DurationFieldConfig
          1. DurationConfigOptions
        9. EmailFieldConfig
        10. LinkToAnotherRecordFieldConfig-and-LinkToAnotherRecordConfigOptions
        11. LongTextFieldConfig
        12. MultipleCollaboratorFieldConfig
        13. MultipleSelectFieldConfig-and-MultipleSelectdConfigOptions
          1. ChoiceModelOptions-and-ChoiceConfigOptions
        14. NumberFieldConfig-and-NumberConfigOptions
          1. PrecisionConfigOptions
        15. PercentFieldConfig-and-PercentConfigOptions
        16. PhoneFieldConfig
        17. RatingFieldConfig
          1. RatingConfigOptions
        18. RichTextFieldConfig
        19. SingleLineTextFieldConfig
        20. SingleSelectFieldConfig-and-SingleSelectdConfigOptions
        21. UrlFieldConfig


[Airtable]: http://www.airtable.com

Clone this wiki locally