Record
Provide manipulate functions on records: get, update, delete, update the record status & assignees in the kintone app
Constructor
Parameter
Name | Type | Required | Description |
---|---|---|---|
connection | Connection | (optional) | The connection module of this SDK. If initializing in browser environment on kintone, this parameter can be ommited to use session authentication. |
Sample code
Init record module
Javascript
// with connection var kintoneRecord = new kintoneJSSDK.Record(connection); // without connection, module will use session authentication of kintone var kintoneRecord = new kintoneJSSDK.Record();
Nodejs
const kintone = require('@kintone/kintone-js-sdk'); let kintoneRecord = new kintone.Record(connection);
Methods
getRecord(app, id)
Retrieves details of 1 record from an app.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
id | Integer | yes | The record ID in kintone app |
Return
Promise
Sample code
Get record
Javascript
var app = {your_app_id}; var id = {your_record_id}; kintoneRecord.getRecord(app, id).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const id = {your_record_id}; kintoneRecord.getRecord(app, id).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
getRecords(app, query, fields, totalCount)
Retrieves details of multiple records from an app using a query string.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
query | String | (optional) | The query string that will specify what records will be responded. |
fields | Array<String> | (optional) | List of field codes you want in the response. |
totalCount | Boolean | (optional) | If "true", the request will retrieve total count of records match with query conditions. |
Return
Promise
Sample code
Get records
Javascript
var app = {your_app_id}; var query = '{your_query_string}'; var fields = [ '{your_field_code}', // another fieldCode ] var totalCount = {your_decide_true_or_false}; kintoneRecord.getRecords(app, query, fields, totalCount).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const query = '{your_query_string}'; const fields = [ '{your_field_code}', // another fieldCode ] const totalCount = /*{your_decide_true_or_false}*/; kintoneRecord.getRecords(app, query, fields, totalCount).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
getAllRecordsByQuery(app, query, fields, totalCount)
- Retrieves details of all records from an app using a query string.
- Can't indicate limit and offset of query.
- Number of records can be retrieved at once is greater than the default limitations
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
query | String | (optional) | The query string that will specify what records will be responded. |
fields | Array<String> | (optional) | List of field codes you want in the response. |
totalCount | Boolean | (optional) | If "true", the request will retrieve total count of records match with query conditions. |
Return
Promise
Sample code
Get all records by query without limitation
Javascript
var app = '{your_app_id}'; var query = '{your_query_string}'; var fields = [ '{your_field_code}', // another fieldCode ] var totalCount = '{your_decide_true_or_false}'; kintoneRecord.getAllRecordsByQuery(app, query, fields, totalCount).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIException console.log(err.get()); });
Nodejs
const app = '{your_app_id}'; const query = '{your_query_string}'; const fields = [ '{your_field_code}', // another fieldCode ] const totalCount = '{your_decide_true_or_false}'; kintoneRecord.getAllRecordsByQuery(app, query, fields, totalCount).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIException console.log(err.get()); });
getAllRecordsByCursor(option)
- Retrieves details of all records from an app using a query string.
- Can't indicate limit and offset of query.
- Number of records can be retrieved at once is greater than the default limitations
Parameter
Name | Type | Required | Description |
---|---|---|---|
option | Object | yes | Option to create cursor |
option.app | Integer | yes | The kintone app ID |
option.query | String | (optional) | The query string that will specify what records will be responded. |
option.fields | Array<String> | (optional) | List of field codes you want in the response. |
Return
Promise
Sample code
Get all records by cursor
Javascript
var rcOption = { app: {your_app_id}, fields: [ '{your_field_code}', // another fieldCode ], query: '{your_query_string}' }; kintoneRecord.getAllRecordsByCursor(rcOption).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIException console.log(err.get()); });
Nodejs
const rcOption = { app: {your_app_id}, fields: [ '{your_field_code}', // another fieldCode ], query: '{your_query_string}' }; kintoneRecord.getAllRecordsByCursor(rcOption).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIException console.log(err.get()); });
addRecord(app, record)
Add one record to an app.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
record | JSONObject | (optional) | The record data to be add to kintone app. About the format, please look the sample below or reference at the end of this page |
Return
Promise
Sample code
Add record
Javascript
var app = 'your_app_id'; var record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; kintoneRecord.addRecord(app, record).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; kintoneRecord.addRecord(app, record).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
addRecords(app, records)
Add multiple records to an app.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
records | Array<JSONObject> | yes | List of records data to be add to kintone app. About the format, please look the sample below or reference at the end of this page. |
Return
Promise
Sample code
Add multi records
Javascript
var app = {your_app_id}; var record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; var records = [ record, // another record ]; kintoneRecord.addRecords(app, records).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; const records = [ record // another record ]; kintoneRecord.addRecords(app, records).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
addAllRecords(app, records)
- Add multiple records to an app.
- Can insert over 2000 records to kintone app, but can't do rollback.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
records | Array<JSONObject> | yes | List of records data to be add to kintone app. About the format, please look the sample below or reference at the end of this page. |
Return
Promise
Sample code
Add all records without limitation
Javascript
var app = '{your_app_id}'; var record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; var records = [ record, // another record ]; kintoneRecord.addAllRecords(app, records).then((rsp) => { console.log(rsp); }).catch((err) => { // Ex: User update 6000 records: // Case 1: the error occur in record 0 // err response // { // results: [KintoneAPIException, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},{}] // } // Case 2: the error occur in record 4000 // err response // { // results: [ // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // KintoneAPIException, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {} // ] // } console.log(err) });
Nodejs
const app = '{your_app_id}'; const record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; const records = [ record // another record ]; kintoneRecord.addAllRecords(app, records).then((rsp) => { console.log(rsp); }).catch((err) => { // Ex: User update 6000 records: // Case 1: the error occur in record 0 // err response // { // results: [KintoneAPIException, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},{}] // } // Case 2: the error occur in record 4000 // err response // { // results: [ // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // AddRecordsResponse, // KintoneAPIException, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {} // ] // } console.log(err) });
updateRecordByID(app, id, record, revision)
Updates details of 1 record in an app by specifying its record number.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
id | Integer | yes | The record ID on kintone app |
record | JSONObject | yes | The record data to be update in kintone app. About the format, please look the sample below or reference at the end of this page. |
revision | Integer | (optional) | The revision number of record |
Return
Promise
Sample code
Update record by ID
Javascript
var app = 'your_app_id'; var id = 'your_record_id'; var record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; var revision = 'revision_of_record'; kintoneRecord.updateRecordByID(app, id, record, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const id = /*{your_record_id}*/; const record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; const revision = /*{revision_of_record}*/; kintoneRecord.updateRecordByID(app, id, record, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
updateRecordByUpdateKey(app, updateKey, record, revision)
Updates details of 1 record in an app by unique key.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
updateKey | JSONObject | yes | The unique key of the record to be updated. About the format, please look the sample below or reference at the end of this page. |
record | JSONObject | yes | The record data will be added to kintone app. About the format, please look the sample below or reference at the end of this page. |
revision | Integer | (optional) | The revision number of record |
Return
Promise
Sample code
Update record by UpdateKey
Javascript
var app = 'your_app_id'; var updateKey = { field: '{your_fieldcode}', value: '{your_fieldcode_value}' }; var record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; var revision = 'revision_of_record'; kintoneRecord.updateRecordByUpdateKey(app, updateKey, record, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const updateKey = { field: '{your_fieldcode}', value: '{your_fieldcode_value}' }; const record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; const revision = /*{revision_of_record}*/; kintoneRecord.updateRecordByUpdateKey(app, updateKey, record, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
updateRecords(app, records)
Updates details of multiple records in an app, by specifying their record number, or a different unique key.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
records | Array<JSONObject> | yes | The record data will be added to kintone app. About the format, please look the sample below or reference at the end of this page. |
Return
Promise
Sample code
Update multi records
Javascript
var app = 'your_app_id'; var record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; var recordUpdate = { id: 'your_record_id', // Optional. Required, if updateKey will not be specified. updateKey: { // Optional. Required, if id will not be specified. field: '{your_field_code}', value: '{your_field_code_value}' }, record: record, revision: 'record_revision_number' // Optional }; var recordsUpdate = [ recordUpdate, // Another recordUpdate ] kintoneRecord.updateRecords(app, recordsUpdate).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; const recordUpdate = { id: /*{your_record_id}*/, // Optional. Required, if updateKey will not be specified. updateKey: { // Optional. Required, if id will not be specified. field: '{your_field_code}', value: '{your_field_code_value}' }, record: record, revision: /*{record_revision_number}*/ // Optional }; const recordsUpdate = [ recordUpdate, // Another recordUpdate ] kintoneRecord.updateRecords(app, recordsUpdate).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
updateAllRecords(app, records)
- Updates details of multiple records in an app, by specifying their record number, or a different unique key.
- Can update over 2000 records to kintone app, but can't do rollback.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
records | Array<JSONObject> | yes | The record data will be added to kintone app. About the format, please look the sample below or reference at the end of this page. |
Return
Promise
Sample code
Update all records without limitation
Javascript
var app = 'your_app_id'; var record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; var recordUpdate = { id: 'your_record_id', // Optional. Required, if updateKey will not be specified. updateKey: { // Optional. Required, if id will not be specified. field: '{your_field_code}', value: '{your_field_code_value}' }, record: record, revision: 'record_revision_number' // Optional }; var recordsUpdate = [ recordUpdate, // Another recordUpdate ] kintoneRecord.updateAllRecords(app, recordsUpdate).then((rsp) => { console.log(rsp); }).catch((err) => { // Ex: User update 6000 records: // Case 1: the error occur in record 0 // err response // { // results: [KintoneAPIException, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},{}] // } // Case 2: the error occur in record 4000 // err response // { // results: [ // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // KintoneAPIException, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {} // ] // } console.log(err) });
Nodejs
const app = /*{your_app_id}*/; const record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; const recordUpdate = { id: /*{your_record_id}*/, // Optional. Required, if updateKey will not be specified. updateKey: { // Optional. Required, if id will not be specified. field: '{your_field_code}', value: '{your_field_code_value}' }, record: record, revision: /*{record_revision_number}*/ // Optional }; const recordsUpdate = [ recordUpdate, // Another recordUpdate ] kintoneRecord.updateAllRecords(app, recordsUpdate).then((rsp) => { console.log(rsp); }).catch((err) => { // Ex: User update 6000 records: // Case 1: the error occur in record 0 // err response // { // results: [KintoneAPIException, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},{}] // } // Case 2: the error occur in record 4000 // err response // { // results: [ // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // UpdateRecordsResponse, // KintoneAPIException, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {} // ] // } console.log(err) });
deleteRecords(app, ids)
Deletes multiple records in an app.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
ids | Array<Integer> | yes | The list ids of record will be delete. |
Return
Promise
Sample code
Delete multi record
Javascript
var app = 'your_app_id'; var ids = [/*your_record_id*/] kintoneRecord.deleteRecords(app, ids).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const ids = [/*your_record_id*/] kintoneRecord.deleteRecords(app, ids).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
deleteRecordsWithRevision(app, idsWithRevision)
Deletes multiple records in an app with revision.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
idsWithRevision | JSONObject | yes | JSONObject format by HashTable<Integer , Integer > (key: The Id of record , value: The Revision of record. ) |
Return
Promise
Sample code
Delete record with revision
Javascript
var app = 'your_app_id'; var idsWithRevision = { /*your_record_id: revision_of_record*/ } kintoneRecord.deleteRecordsWithRevision(app, idsWithRevision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const idsWithRevision = { /*your_record_id: revision_of_record*/ } kintoneRecord.deleteRecordsWithRevision(app, idsWithRevision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
deleteAllRecordsByQuery(app, query)
- Deletes all records in an app by query string
- Can delete over 2000 records, but can't do rollback.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
query | String | (optional) | The query string that will specify what records will be responded. |
Return
Promise
Sample code
Delete all records by query string
Javascript
var app = 'your_app_id'; var query = 'your_query_string'; kintoneRecord.deleteAllRecordsByQuery(app, query).then((rsp) => { console.log(rsp); }) .catch((err) => { // Ex: User update 6000 records: // Case 1: the error occur in record 0 // err response // { // results: [KintoneAPIException, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},{}] // } // Case 2: the error occur in record 4000 // err response // { // results: [ // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // KintoneAPIException, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {} // ] // } console.log(err) });
Nodejs
const app = 'your_app_id'; const query = 'your_query_string'; kintoneRecord.deleteAllRecordsByQuery(app, query).then((rsp) => { console.log(rsp); }) .catch((err) => { /// Ex: User update 6000 records: // Case 1: the error occur in record 0 // err response // { // results: [KintoneAPIException, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},{}] // } // Case 2: the error occur in record 4000 // err response // { // results: [ // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // RecordsResponseDelete, // KintoneAPIException, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {}, // {} // ] // } console.log(err) });
upsertRecord(app, updateKey, record, revision)
Insert or update a record to kintone app. Insert the record if the updateKey doesn't exists and update the record if the updateKey exists.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
updateKey | JSONObject | yes | The unique key of the record to be updated. About the format, please look the sample below or reference at the end of this page. |
record | JSONObject | yes | The record data will be added to kintone app. About the format, please look the sample below or reference at the end of this page. |
revision | Integer | (optional) | The revision number of record |
Return
Promise
Sample code
Upsert record by UpdateKey
Javascript
var app = 'your_app_id'; var updateKey = { field: 'your_fieldcode', value: 'your_fieldcode_value' }; var record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; var revision = 'revision_of_record'; kintoneRecord.upsertRecord(app, updateKey, record, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const updateKey = { field: '{your_fieldcode}', value: '{your_fieldcode_value}' }; const record = { YourFieldCode: { value: 'Value Of YourFieldCode' }, // Another fieldcode here }; const revision = 'revision_of_record'; kintoneRecord.upsertRecord(app, updateKey, record, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
upsertRecords(app, records)
Insert or update up to 1500 records to kintone app. If the records are over 1500, It is thrown Error. Insert the records if the updateKey doesn't exists and update the records if the updateKey exists.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
records | Array |
yes | The record data Array which has updateKey and record. About the format, please look the sample below or reference at the end of this page. |
Return
Promise
Sample code
Upsert records by UpdateKey
Javascript
var app = 'your_app_id'; var records = [ { updateKey: { field: 'your_fieldcode', value: 'your_fieldcode_value_1' }, record: { YourFieldCode: { value: 'Value Of YourFieldCode 1' }, } }, { updateKey: { field: 'your_fieldcode', value: 'your_fieldcode_value_2' }, record: { YourFieldCode: { value: 'Value Of YourFieldCode 2' }, } }, { updateKey: { field: 'your_fieldcode', value: 'your_fieldcode_value_3' }, record: { YourFieldCode: { value: 'Value Of YourFieldCode 3' }, } } ]; recordModule.upsertRecords(app, records).then((resp) => { console.log(resp); }).catch((e) => { /// Ex: User upsert over 100 records: // Case 1: the error occurs on a first record // err response // { // results: [KintoneAPIException, {},...] // } // Case 2: the error occurs on the 100th or more record // err response // { // results: [{},..., KintoneAPIException, {},...] // } console.log(err.get()); });
Nodejs
const app = 'your_app_id'; const records = [ { updateKey: { field: 'your_fieldcode', value: 'your_fieldcode_value_1' }, record: { YourFieldCode: { value: 'Value Of YourFieldCode 1' }, } }, { updateKey: { field: 'your_fieldcode', value: 'your_fieldcode_value_2' }, record: { YourFieldCode: { value: 'Value Of YourFieldCode 2' }, } }, { updateKey: { field: 'your_fieldcode', value: 'your_fieldcode_value_3' }, record: { YourFieldCode: { value: 'Value Of YourFieldCode 3' }, } } ]; recordModule.upsertRecords(app, records).then((resp) => { console.log(resp); }).catch((e) => { /// Ex: User upsert over 100 records: // Case 1: the error occurs on a first record // err response // { // results: [KintoneAPIException, {},...] // } // Case 2: the error occurs on the 100th or more record // err response // { // results: [{},..., KintoneAPIException, {},...] // } console.log(err.get()); });
updateRecordAssignees(app, id, assignees, revision)
Update assignees of a record.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
id | Integer | yes | The record ID of kintone app |
assignees | Array<String> | yes | The user code(s) of the assignee(s) |
revision | Integer | (option) | The revision number of record |
Return
Promise
Sample code
update record Assignees
Javascript
var app = 'your_app_id'; var id = 'your_record_id'; var assignees = [/*your_assignee(s)*/]; var revision = 'revision_of_record'; kintoneRecord.updateRecordAssignees(app, id, assignees, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const id = /*{your_record_id}*/; const assignees = [/*your_assignee(s)*/]; const revision = /*{revision_of_record}*/; kintoneRecord.updateRecordAssignees(app, id, assignees, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
updateRecordStatus(app, id, action, assignee, revision)
Updates the Status of a record of an app.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID. |
id | Integer | yes | The record ID on kintone app. |
action | String | yes | The Action name will be run. |
assignee | String | (Conditionally required) | The next Assignee. Specify the Assignee's log in name.Required, if the "Assignee List" of the current status is set to "User chooses one assignee from the list to take action", and a selectable assignee exists. |
revision | Integer | (optional) | The revision of record |
Return
Promise
Sample code
Update record status
Javascript
var app = 'your_app_id'; var id = 'your_record_id'; var action = 'your_action_name'; var assignee = '/*your_assignee(s)*/'; var revision = 'revision_of_record'; kintoneRecord.updateRecordStatus(app, id, action, assignee, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const id = /*{your_record_id}*/; const action = /*{your_action_name}*/; const assignee = '/*your_assignee(s)*/'; const revision = /*{revision_of_record}*/; kintoneRecord.updateRecordStatus(app, id, action, assignee, revision).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
updateRecordsStatus(app, records)
Updates the Status of multiple records of an app.
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
records | Array<JSONObject> | yes | The recod status data. See belowsample codee or reference at the end of this page to know format. |
Return
Promise
Sample code
Update multi record status
Javascript
var app = 'your_app_id'; var recordStatusUpdateItem = { id: 'your_record_id', action: 'your_action_name', assignee: 'your_assignee', revision: 'your_record_revision' } var records = [ recordStatusUpdateItem, 'another data like recordStatusUpdateItem' ]; kintoneRecord.updateRecordsStatus(app, records).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const recordStatusUpdateItem = { id: /*your_record_id*/, action: '/*your_action_name*/', assignee: '/*your_assignee*/', revision: /*your_record_revision*/ } const records = [ recordStatusUpdateItem, /*another data like recordStatusUpdateItem*/ ]; kintoneRecord.updateRecordsStatus(app, records).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
getComments(app, record, order, offset, limit)
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
record | Integer | yes | The ID of record |
order | String | (optional) | The sort order of the Comment ID. Please select asc or desc |
offset | Integer | (optional) | The number of first comments will be ignored. |
limit | Integer | (optional) | The number of records to retrieve. |
Return
Promise
Sample code
Get comments
Javascript
var app = 'your_app_id'; var id = 'your_record_id'; var order = 'your_order_type'; // asc or desc var offset = 'your_offset_number'; var limit = 'your_limit number'; kintoneRecord.getComments(app, id, order, offset, limit).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const id = /*{your_record_id}*/; const order = /*{your_order_type}*/; // asc or desc const offset = /*{your_offset_number}*/; const limit = /*{your_limit number}*/; kintoneRecord.getComments(app, id, order, offset, limit).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
addComment(app, record, comment)
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
record | Integer | yes | The ID of record |
comment | JSONObject | yes | About the format, please look the sample below or reference at the end of this page. |
Return
Promise
Sample code
Add comment
Javascript
var app = 'your_app_id'; var record = 'your_record_id'; var comment = { text: '/*your_comment_content*/', mentions: [ { code: '/*your_member_code*/', type: '/*your_member_type*/' // either `USER` or `GROUP` or `ORGANIZATION` }, // another mention here ] }; kintoneRecord.addComment(app, record, comment).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const record = /*{your_record_id}*/; const comment = { text: '/*your_comment_content*/', mentions: [ { code: '/*your_member_code*/', type: '/*your_member_type*/' // either `USER` or `GROUP` or `ORGANIZATION` }, // another mention here ] }; kintoneRecord.addComment(app, record, comment).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
deleteComment(app, record, comment)
Parameter
Name | Type | Required | Description |
---|---|---|---|
app | Integer | yes | The kintone app ID |
record | Integer | yes | The record ID on kintone app |
comment | Integer | yes | The comment ID on kintone record |
Return
Promise
Sample code
Delete comment
Javascript
var app = 'your_app_id'; var record = 'your_record_id'; var comment = 'your_comment_id'; kintoneRecord.deleteComment(app, record, comment).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Nodejs
const app = /*{your_app_id}*/; const record = /*{your_record_id}*/; const comment = /*{your_comment_id}*/; kintoneRecord.deleteComment(app, record, comment).then((rsp) => { console.log(rsp); }).catch((err) => { // This SDK return err with KintoneAPIExeption console.log(err.get()); });
Reference
- Get Record
on developer network
- Add Record
on developer network
- Update Record
on developer network
- Delete Record
on developer network
- Get Comments
on developer network
- Add Comment
on developer network
- Delete Comment
on developer network
- Update Record Status
on developer network
- Update Record Assignees
on developer network