Code Monkey home page Code Monkey logo

airtabler's Introduction

AirtableR

R wrapper to the Airtable API

For more information on the Airtable API see: http://api.airtable.com/

Quick Start

Installation

> devtools::install_github("jsng/AirtableR")
> library(AirtableR)

Authentication

Firstly, you should enter your Airtable API key.

> airtable <- Airtable(
    base = "<YOUR BASE NAME>", # e.g "appZNrwXN7bsOU0ta"
    tables = c("archive", "items") # table names
  )
Couldn't find env var AIRTABLE_KEY. See ?airtable_key for more details.
Please enter your KEY and press enter:

You can also set Airtable API Key in .Renviron file.

AIRTABLE_KEY=<YOUR API KEY HERE>

Basic Usage

List all Records

> records <- airtable$archive$list_records()
> str(records)

List of 363
 $ :List of 3
  ..$ id         : chr "rec0E97Ze9J6iyLBW"
  ..$ fields     :List of 19
  .. ..$ permalink               : chr "nogarifilm"
  .. ..$ is_live                 : chr "true"
  .. ..$ amount                  : int 700000
  .. ..$ count                   : int 13
  .. ..$ start_date              : chr "2016-02-02"

Retrieve a Record

> record <- airtable$archive$retrieve_record("rec0E97Ze9J6iyLBW")
> str(record)

List of 3
 $ id         : chr "rec0E97Ze9J6iyLBW"
 $ fields     :List of 19
  ..$ permalink               : chr "nogarifilm"
  ..$ is_live                 : chr "true"
  ..$ amount                  : int 700000
  ..$ count                   : int 13
  ..$ start_date              : chr "2016-02-02"

Create a Record

> airtable$archive$create_record(fields = list(field_name = "foo"))
Response [https://api.airtable.com/v0/<YOUR BASE NAME>/archive/<RECORD_ID>]
  Date: 2016-03-13 12:57
  Status: 200
  Content-Type: application/json; charset=utf-8
  Size: 41 B

Update a Record

# Issuing a PATCH request
> airtable$archive$update_record("<RECORD_ID>", fields = list(field_name = "bar"))
Response [https://api.airtable.com/v0/<YOUR BASE NAME>/archive/<RECORD_ID>]
  Date: 2016-03-13 12:57
  Status: 200
  Content-Type: application/json; charset=utf-8
  Size: 41 B
# Issuing a PUT request
> airtable$archive$update_record("<RECORD_ID>", fields = list(field_name = "foobar"), method = "put")
Response [https://api.airtable.com/v0/<YOUR BASE NAME>/archive/<RECORD_ID>]
  Date: 2016-03-13 12:57
  Status: 200
  Content-Type: application/json; charset=utf-8
  Size: 41 B

Delete a Record

> airtable$archive$delete_record("<RECORD_ID>")
Response [https://api.airtable.com/v0/<YOUR BASE NAME>/archive/<RECORD_ID>]
  Date: 2016-03-13 12:57
  Status: 200
  Content-Type: application/json; charset=utf-8
  Size: 41 B

airtabler's People

Contributors

jaeseungyum avatar statwonk avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

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.