Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

HttpRequestException using Airtable.net APIs

427 0
cancel
Showing results for 
Search instead for 
Did you mean: 

I get this exception:
Exception thrown: ‘System.Net.Http.HttpRequestException’ in mscorlib.dll
An error occurred while sending the request. - System.Net.Http.HttpRequestException
The program ‘[10796] Test.vshost.exe’ has exited with code -1 (0xffffffff).


The code of Airtable.net in github is at link: GitHub - ngocnicholas/airtable.net: Airtable .NET API Client
The code I wrote for using of Airtable.net APIs:

private async void GetRecord(string id)
{
using (AirtableBase airtableBase = new AirtableBase(appKey, baseId))
{
Task task= airtableBase.RetrieveRecord(appTable, id);

            AirtableRetrieveRecordResponse response = null;
            try
            {
                response = await task;
            }
            catch (System.Net.Http.HttpRequestException ex)
            {
                Console.WriteLine(ex.Message.ToString() + " - " + ex.GetType());
                //throw;
            }

            if (!response.Success)
            {
                string errorMessage = null;
                if (response.AirtableApiError is AirtableApiException)
                {
                    errorMessage = response.AirtableApiError.ErrorMessage;
                }
                else
                {
                    errorMessage = "Unknown error";
                }
                Console.WriteLine(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(id);
                foreach (var attachmentField in attachmentList)
                {
                    Console.WriteLine(attachmentField.ToString());
                }
            }
        }
    }

I catch exception at this line:
catch (System.Net.Http.HttpRequestException ex).
Why the trying to request to airtable database fails?

0 Replies 0