Skip to content

Bulk Request

The Bulk Request API allows multiple API requests to run on multiple kintone apps. The below API can be used with the Bulk Request API:

  • Add Record
  • Add Records
  • Update Record
  • Update Records
  • Delete Records
  • Update Status
  • Update Statuses
  • Update Assignees

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 bulk request module

Javascript

  // with connection
  var kintoneBulkRequest = new kintoneJSSDK.BulkRequest(connection);

  // without connection, module will use session authentication of kintone
  var kintoneBulkRequest = new kintoneJSSDK.BulkRequest();

Nodejs


  const kintone = require('@kintone/kintone-js-sdk');
  let kintoneBulkRequest = new kintone.BulkRequest(connection);

Methods

All below methods (excluded execute() method) will add request to queue, you must execute the execute() function to get result of BulkRequest.

addRecord(app, record)

Parameter

See at Record - addRecord

Return

BulkRequest

addRecords(app, records)

Parameter

See at Record - addRecords

Return

BulkRequest

updateRecordByID(app, id, record, revision)

Parameter

See at Record - updateRecordByID

Return

BulkRequest

updateRecordByUpdateKey(app, updateKey, record, revision)

Parameter

See at Record - updateRecordByUpdateKey

Return

BulkRequest

updateRecords(app, records)

Parameter

See at Record - updateRecords

Return

BulkRequest

deleteRecords(app, ids)

Parameter

See at Record - deleteRecords

Return

BulkRequest

deleteRecordsWithRevision(app, idsWithRevision)

Parameter

See at Record - deleteRecordsWithRevision

Return

BulkRequest

updateRecordAssignees(app, record, assignees, revision)

Parameter

See at Record - updateRecordAssignees

Return

BulkRequest

updateRecordStatus(app, id, action, assignee, revision)

Parameter

See at Record - updateRecordStatus

Return

BulkRequest

updateRecordsStatus(app, records)

Parameter

See at Record - updateRecordsStatus

Return

BulkRequest

execute()

Execute the bulk request and get data response

Parameter

(none)

Return

[Promise]

Sample code

Execute bulk request

Javascript


  var responseBulkRequest = kintoneBulkRequest
    .addRecord(/*[Args]*/)
    .addRecords(/*[Args]*/)
    .updateRecords(/*[Args]*/)
    .deleteRecords()
    .execute();

  responseBulkRequest.then((resp) => {
    console.log(resp);
  }).catch((err) => {
    // write error to console
    console.log(err.get());
    // Throw error
    err.throw();
  });

Nodejs


  const responseBulkRequest = kintoneBulkRequest
    .addRecord(/* [Args]*/)
    .addRecords(/* [Args]*/)
    .updateRecords(/* [Args]*/)
    .deleteRecords()
    .execute();

  responseBulkRequest.then((resp) => {
    console.log(resp);
  }).catch((err) => {
    // write error to console
    console.log(err.get());
    // Throw error
    err.throw();
  });

Reference