This package allows one to compose kintone REST API requests and convenient functions to convert kintone-JSON/R-Objects in R scriptings.
kintone is very useful and powerful cloud service provided by Cybozu, inc.
(NOTICE) This package has not yet been fully tested for bugs.
BSD_2_clause
- RCurl
- rjson
R CMD INSTALL kintone_0.1.tar.gz
in your console on Mac OS X/Linux
or
install.packages("kintone")
in your R console
You can set parameters with R-format, and get responses with R-format, too.
(NOTE) Sample code files are here.
First, you include library "kintone", and access to your "cybozu.com domain" with your "user id" and "user password".
library(kintone) # load "kintone" package
kintone <- Kintone("cybozu.com domain", "user id", "user password") # declare Kintone object w/o basic authentication
In case basic authentication is required,
kintone <- Kintone("cybozu.com domain", "user id", "user password", "basic id", "basic password") # declare Kintone object w/ basic authentication
For single record retrieval,
app <- 7 # application ID
id <- 7 # record ID
kintone@getRecord(app, id)
For several records retrieval,
app <- 113 # application ID
query <- 'createDay > "2014-02-28" and createDay < "2014-03-02"' # query strings
fields <- list("createDay", "lat", "lon") # fields list (R-list)
kintone@getRecords(app, query=query, fields=fields)
and you can omit query
and/or fields
options as follows.
kintone@getRecords(app)
For single record registration,
app <- 113 # application ID
record <- c(list("lat"=list("value"=31.7401)),
list("lon"=list("value"=130.7536))
) # record (kintone-like R-vector)
kintone@registRecord(app, record)
For several records registration,
app <- 113 # application ID
records <- list(c(list("lat"=list("value"=31.7401)),
list("lon"=list("value"=130.7536))
),
c(list("lat"=list("value"=51.7401)),
list("lon"=list("value"=150.7536))
)
) # records (kintone-like R-list)
kintone@registRecords(app, records)
For single record update,
app <- 113 # application ID
id <- 1245 # record ID
record <- c(list("lat"=list("value"=31.7401)),
list("lon"=list("value"=130.7536))
) # record (kintone-like R-vector)
kintone@updateRecord(app, id, record)
For several records update,
app <- 113 # application ID
records <- list(list("id"=1244,
"record"=c(list("lat"=list("value"=31.7401)),
list("lon"=list("value"=130.7536))
)
),
list("id"=1245,
"record"=c(list("lat"=list("value"=51.7401)),
list("lon"=list("value"=150.7536))
)
)
) # records (kintone-like R-list)
kintone@updateRecords(app, records)
app <- 113 # application ID
ids <- list(1240, 1241) # record IDs (R-list)
kintone@deleteRecords(app, ids)
fileName <- "README.md" # file name
kintone@uploadFile(fileName)
(NOTE) You can download text files only in this method now.
fileKey <- "87115c38-908e-40ea-b10b-fe8a26698b55" # file key
kintone@downloadFile(fileKey)
You can set a spaceId
option as follows.
spaceId <- 5
# For retreival methods
kintone@getRecord(app, id, spaceId=spaceId)
kintone@getRecords(app, query=query, fields=fields, spaceId=spaceId)
# For regist methods
kintone@registRecord(app, record, spaceId=spaceId)
kintone@registRecords(app, records, spaceId=spaceId)
# For update methods
kintone@updateRecord(app, id, record, spaceId=spaceId)
kintone@updateRecords(app, records, spaceId=spaceId)
# For delete method
kintone@deleteRecords(app, ids, spaceId=spaceId)