Node-kintone
A Node.js wrapper for kintone API.
Installation
Install via npm
npm install kintone
Getting Started
The following example fetches the information of an app by API token:
// import 'kintone' modulevar kintone = ; // Access Kintone API on 'example.cybozu.com' with username/passwordvar api = 'example.cybozu.com' authorization: username: "XXXXXXXX" password: "XXXXXXXX" ; // Get records of app 1apirecords;
Promise and callback
The API results are returned asynchronously. Both callback-style and promise-style are supported.
// Get records of app 1 via callbackapirecords; // Get records of app 1 with Promiseapirecords; // Get records of app 1 with await/async (ES7)try let response = await apirecords; console; catch err // Handle err
Authentication
Authorization with User authentication(ja):
var api = 'example.cybozu.com' authorization: username: "XXXXXXXX" password: "XXXXXXXX" ;
Authorization with Basic authentication:
var api = 'example.cybozu.com' authorization: username: "XXXXXXXX" password: "XXXXXXXX" basic: username: "YYYYYYYY" password: "YYYYYYYY" ;
Authorization with API Token authentication(ja):
var token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";var api = 'example.cybozu.com' token: token ;
Authorization with OAuth token (ja):
var oauthToken = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";var api = 'example.cybozu.com' oauthToken: oauthToken ;
App APIs
Get information of an app:
apiapp;
Get information of apps:
apiapps;
Update information of an app:
apipreviewapp;
Deploy the preview app:
apipreviewappdeploy;
Get the status of the preview apps:
apipreviewappdeploy;
Get the fields of an app:
apiappformfields;
Get the fields of a preview app:
apipreviewappformfields;
Create fields of a preview app:
var params = app: 1 properties: "Text__single_line_1": type: "SINGLE_LINE_TEXT" code: "Text__single_line_1" label: "Name" "Number": type: "NUMBER" code: "Number" label: "Age" ;apipreviewappformfields;
Update the fields of a preview app:
var params = app: 1 rights: filterCond: "Created_datetime > \"2011-11-07T09: 00: 00Z\"" code: "Text__single_line_1" entities: entity: type: "ORGANIZATION" code: "org1" accessibility: "READ" entity: type: "GROUP" code: "everyone" accessibility: "NONE" ;apipreviewappformfields;
Delete the fields of a preview app:
apipreviewappformfields;
Get the field layout of of an app:
apiappformlayout;
Get the field layout of of a preview app:
apipreviewappformlayout;
Update the field layout of of a preview app:
var params = app: 1 layout: type: "ROW" fields: type: "SINGLE_LINE_TEXT" code: "Text__single_line_1" size: width: 250 ;apipreviewappformlayout;
Get the view of an app:
apiappviews;
Get the view of a preview app:
apipreviewappviews;
Update the view of a preview app:
var params = app: 1 views: "My List View": index: 0 type: "LIST" name: "My List View" fields: "Record_number" "Text__single_line_1" filterCond: "Updated_datetime > LAST_WEEK()" sort: "Record_number asc" "(Assigned to me)": index: 3 type: "LIST" ;apipreviewappviews;
Update the settings of an app:
apiappsettings;
Update the settings of a preview app:
apipreviewappsettings;
Get the process management of an app.:
apiappstatus;
Get the process management of an app.:
apipreviewappstatus;
Update the process management of an app.:
apipreviewappstatus;
Get the customize of an app:
apiappcustomize;
Get the customize of a preview app:
apipreviewappcustomize;
Update the customize of a preview app:
apipreviewappcustomize;
Get the permissions of an app:
apiappacl;
Get the permissions of a preview app:
apipreviewappacl;
Update the permissions of an app:
var params = app: 1 rights: filterCond: "Created_datetime > \"2011-11-07T09:00:00Z\"" entity: type: "CREATOR" appEditable: true recordViewable: true recordAddable: true recordEditable: true recordDeletable: true entity: type: "GROUP" code: "everyone" recordViewable: true recordAddable: true ;apiappacl;
Update the permissions of a preview app:
var params = app: 1 rights: filterCond: "Created_datetime > \"2011-11-07T09:00:00Z\"" entity: type: "CREATOR" appEditable: true recordViewable: true recordAddable: true recordEditable: true recordDeletable: true entity: type: "GROUP" code: "everyone" recordViewable: true recordAddable: true ;apipreviewappacl;
Get the record permissions of an app:
apirecordacl;
Get the record permissions of a preview app:
apipreviewrecordacl;
Update the record permissions of an app:
var params = app: 1 rights: filterCond: "Created_datetime > \"2011-11-07T09:00:00Z\"" entities: entity: type: "ORGANIZATION" code: "org1" viewable: false editable: false deletable: false includeSubs: true ;apirecordacl;
Update the record permissions of a preview app:
var params = app: 1 rights: filterCond: "Created_datetime > \"2011-11-07T09:00:00Z\"" entities: entity: type: "ORGANIZATION" code: "org1" viewable: false editable: false deletable: false includeSubs: true ;apipreviewrecordacl;
Get the field permissions of an app:
apifieldacl;
Get the field permissions of a preview app:
apipreviewfieldacl;
Update the field permissions of an app:
var params = app: 1 rights: filterCond: "Created_datetime > \"2011-11-07T09: 00: 00Z\"" code: "Text__single_line_1" entities: entity: type: "ORGANIZATION" code: "org1" accessibility: "READ" entity: type: "GROUP" code: "everyone" accessibility: "NONE" ;apifieldacl;
Update the field permissions of a preview app:
var params = rights: filterCond: "Updated_datetime > \"2012-02-03T09: 00: 00Z\" and Updated_datetime < \"2012-02-03T10: 00: 00Z\"" entities: entity: type: "ORGANIZATION" code: "org1" viewable: false editable: false deletable: false includeSubs: true entity: type: "FIELD_ENTITY" code: "Updated_by" viewable: true editable: true deletable: true ;apipreviewfieldacl;
Evaluate the record permission:
apirecordsaclevaluate;
Get the form informations of an app:
apiform;
Get the form informations of a preview app:
apipreviewform;
Record APIs
Get the record of an app:
apirecord;
Get multiple records of an app:
apirecords;
Create a record of an app:
var params = app: 1 record: "Text__single_line_1": value: "Hello!" apirecord;
Create multiple records of an app:
var params = app: 1 records: "Text__single_line_1": value: "Apple" "Text__single_line_1": value: "Banana" ;apirecords;
Update the record of an app:
var params = app: 1 id: 1 record: "Text__single_line_1": value: "Good morning!" apirecord;
Update the records of an app:
var params = app: 1 records: id: 5 record: "Text__single_line_1": value: "Cherry" id: 6 record: "Text__single_line_1": value: "Grape" ;apirecords;
Delete the records of an app:
apirecords;
Get the record comments of an app:
apirecordcomments;
Create a record comment of an app:
var params = app: 1 record: 10 comment: text: "Good morning!" ;apirecordcomment;
Delete a record comment of an app:
apirecordcomment;
Download a file:
apifile;
Upload a file:
apifile;
Execute multiple API requests:
var params = requests: method: "POST" api: "/k/v1/record.json" payload: app: 1 record: "Text__single_line_1": value: "Delete logs" method: "DELETE" api: "/k/v1/records.json" payload: app: 2 ids: 10 11 ;apibulkRequest;
Update status of a record:
apirecordstatus;
Update status of records:
var params = app: 1 records: "id": 11 "action": "Submit" "assignee": "alice" "id": 12 "action": "Cancel" ;apirecordsstatus;
Update assignees of a record:
apirecordassignees;
Space APIs
Get a space:
apispace;
Create a space from space template:
var params = id: 1 name: "My Space" members: "entity": "type": "USER" "code": "alice" "isAdmin": true "entity": "type": "ORGANIZATION" "code": "org1" "includeSubs": true apitemplatespace;
Update the body of a space:
apispacebody;
Delete a space:
apispace;
Get the members of a space:
apispacemembers;
Update the member of a space:
var params = id: 4 members: "entity": "type": "USER" "code": "alice" "isAdmin": true "entity": "type": "ORGANIZATION" "code": "org1" "includeSubs": true apispacemembers;
Create a thread comment of a space:
var params = space: 1 thread: 10 comment: "text": "Hello, everyone!" ;apispacethreadcomment;
Create a thread of a space:
var params = id: 9 name: "Self-introduction" body: "<b>Welcome!</b>";apispacethread;
Add guest users:
apiguests;
Update the guest members of a space:
apispaceguests;
Delete guest users:
apiguests;
API Documentation
LICENSE
MIT