Coder Social home page Coder Social logo

airtable.net's Introduction

Airtable .NET API Client

Airtable.net is the C-Sharp client of the public APIs of Airtable. It builds a Windows class library that targets .NET Standard named AirtableClientApi.dll. AirtableClientApi.dll facilitates the usage of Airtable APIs without having to worry about interfacing with raw HTTP, the low-level concepts like HTTP status codes and records paging. The users can write C-Sharp applications which integrate with Airtable by consuming what Airtable public APIs have to offer programmatically such as List Records, Create Record, Retrieve Record, Update Record, Replace Record, Delete Record.

Installation

Install the latest nuget package Airtable.1.2.0.nupkg

Requirements

Operating System: Windows 10 or newer Microsoft Visual Studio 2022 or newer (only if you choose to build AirtableApiClient.dll from source files using the instructions below.) .NET Standard 2.0 and the usage of System.Text.Json are supported in Visual Studio 2022.

Build AirtableApiClient.dll

Download Airtable.net c# source files from github.com. To compile to an assembly, simply create a new project in visual studio of C# .NET Standard Class Library and add these source files to the project.

Refer to this link for downloading VS 2022 Community Edition: https://visualstudio.microsoft.com/free-developer-offers/

Refer to the link below for downloading .NET SDK for VS 2022 https://dotnet.microsoft.com/download/visual-studio-sdks

Refer to the link below to learn more about what's in .NET Standard 2.0 https://docs.microsoft.com/en-us/dotnet/standard/net-standard

Quickstart

Example demonstrating usage of the API to list records:



using System;
using System.Collections.Generic;
using System.Text.Json;
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>();

    using (AirtableBase airtableBase = new AirtableBase(appKey, baseId))
    {
       //
       // Use 'offset' and 'pageSize' to specify the records that you want
       // to retrieve.
       // 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,
                   fields,
                   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;
                if (response.AirtableApiError is AirtableInvalidRequestException)
                {
                    errorMessage += "\nDetailed error message: ";
                    errorMessage += response.AirtableApiError.DetailedErrorMessage;
                }
                break;
            }
            else
            {
                errorMessage = "Unknown error";
                break;
            }
        } while (offset != null);
    }

    if (!string.IsNullOrEmpty(errorMessage))
    {
        // Error reporting
    }
    else
    {
        // Do something with the retrieved 'records' and the 'offset'
        // for the next page of the record list.
    }


Documentation

View the full documentation

airtable.net's People

Contributors

ngocnicholas avatar garychapman avatar hamzasaleem2 avatar hinek avatar kyubuns avatar

Stargazers

Jonathan Flores avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.