Learn R Programming

kntnr (version 0.4.4)

kntn_record: 'kintone' Record API

Description

kntn_record() gets a single record from the specified kintone application. kntn_records() retrieves multiple records at once. If the number of records is more than records_per_request (the default is 100), kntn_records() automatically splits the request into smaller subrequests.

Usage

kntn_record(app, id, as = c("data.frame", "list", "text"), verbose = FALSE)

kntn_records( app, fields = NULL, query = "", max_records = 1000L, offset = 0L, records_per_request = 100L, as = c("data.frame", "list", "text"), verbose = FALSE )

Arguments

app

App ID.

id

Record ID.

as

Desired type of output: data.frame, list or text (data.frame means tbl_df).

verbose

If TRUE, output logs verbosely.

fields

Names of fields.

query

Query (e.g. "updated_time > \"2012-02-03T09:00:00+0900\" and updated_time < \"2012-02-03T10:00:00+0900\"").

max_records

Max number of records to get.

offset

Offset of records.

records_per_request

Number of records per request (max: 100).

Details

A field will be converted to the correspondent object by the type:

  • RECORD_NUMBER: character

  • __ID__: integer

  • __REVISION__: integer

  • CREATOR: character (code)

  • CREATED_TIME: POSIXct

  • MODIFIER: character (code)

  • UPDATED_TIME: POSIXct

  • SINGLE_LINE_TEXT: character

  • NUMBER: numeric

  • CALC: character

  • MULTI_LINE_TEXT: character

  • RICH_TEXT: character

  • CHECK_BOX: nested character

  • RADIO_BUTTON: character

  • DROP_DOWN: character

  • MULTI_SELECT: nested character

  • FILE: nested tbl_df

  • LINK: character

  • DATE: Date

  • TIME: character (R has no correspondent class for this)

  • DATETIME: POSIXct

  • USER_SELECT: nested character (code)

  • ORGANIZATION_SELECT: nested character (code)

  • GROUP_SELECT: nested character (code)

  • CATEGORY: nested character

  • STATUS: character

  • STATUS_ASSIGNEE: character

  • SUBTABLE: nested tbl

Some types will be converted to nested objects. You can unnest these fields by kntn_unnest.

See Also

https://developer.kintone.io/hc/en-us/articles/213149287/

Examples

Run this code
# NOT RUN {
kntn_set_auth()

app <- 10

# get a single record
d <- kntn_record(app, id = 1)

# get records up to 1000 (default)
d <- kntn_records(app)

# get records up to 5000 records at the latency of 500 records/request.
d <- kntn_records(app, max_records = 5000, records_per_request = 500L)

# get records as list
d <- kntn_records(app, as = "list")

# get records matched with the specified query and fields.
# See https://developer.kintone.io/hc/en-us/articles/213149287/ for the query syntax
d <- kntn_records(app, fields = c("timestamp", "value"),
                  query = "updated_time > \"2016-10-03T09:00:00+0900\"")

# Some types like SUBTABLE are converted as nested data.frame.
# You can unnest them by using kntn_unnest.
kntn_unnest(d)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab