Skip to content

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 yes The connection module of this SDK.

Sample code

Init record module Source code

String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

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

GetRecordResponse

Sample code

Get record Source code

String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute GET RECORD API
Integer appID = 1;
Integer recordID = 1;
GetRecordResponse response = kintoneRecordManager.getRecord(appID, recordID);

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 ArrayList<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

GetRecordsResponse

Sample code

Get records Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute GET RECORDS API
Integer appID = 1;
String query = "$id >=" +  1 + "and $id <=" + 10 + "order by $id asc";
GetRecordsResponse response = kintoneRecordManager.getRecords(appID, query, null, true);

getAllRecordsByCursor(Integer app, String query, Array<String> fields)

Retrieves details of all 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 ArrayList<String> (optional) List of field codes you want in the response.

Return

GetRecordsResponse

Sample code

Get all records by cursor Source code
    String USERNAME = "YOUR_USERNAME";
    String PASSWORD = "YOUR_PASSWORD";

    // Init authenticationAuth
    Auth kintoneAuthWithPassword = new Auth();
    kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

    // Init Connection without "guest space ID"
    Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

    // Init Record Module
    Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

    // execute GET RECORDS API
    Integer appID = 1;
    String query = "$id >=" +  1 + "and $id <=" + 10 + "order by $id asc";
    GetRecordsResponse response = kintoneRecordManager.getAllRecordsByCursor(appID, query, null);

addRecord(app, record)

Add one record to an app.

Parameter

Name Type Required Description
app Integer yes The kintone app ID
record HashMap<String, FieldValue> (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

AddRecordResponse

Sample code

Add record Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute ADD RECORD API
Integer appID = 1;
HashMap<String, FieldValue> record = new HashMap<String, FieldValue>();

FieldValue fv = new FieldValue();
fv.setType(FieldType.SINGLE_LINE_TEXT);
fv.setValue("sample_AddRecord");
record.put("FieldCode1", fv);

AddRecordResponse response = kintoneRecordManager.addRecord(appID, record);

addRecords(app, records)

Add multiple records to an app.

Parameter

Name Type Required Description
app Integer yes The kintone app ID
records ArrayList<HashMap<String, FieldValue>> 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

AddRecordsResponse

Sample code

Add multi records Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute ADD RECORDS API
Integer appID = 1;
ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>();
HashMap<String, FieldValue> record1 = new HashMap<String, FieldValue>();
HashMap<String, FieldValue> record2 = new HashMap<String, FieldValue>();

FieldValue fv = new FieldValue();
fv.setType(FieldType.SINGLE_LINE_TEXT);
fv.setValue("sample_AddRecords1");

FieldValue fv2 = new FieldValue();
fv2.setType(FieldType.SINGLE_LINE_TEXT);
fv2.setValue("sample_AddRecords2");

record1.put("FieldCode1", fv);
record2.put("FieldCode1", fv2);

records.add(record1);
records.add(record2);

AddRecordsResponse response = kintoneRecordManager.addRecords(appID, records);

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 HashMap<String, FieldValue> 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

UpdateRecordResponse

Sample code

Update record by ID Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute UPDATE RECORD API
Integer appID = 1;
Integer recordID = 1;
Integer revision = 1;

HashMap<String, FieldValue> record = new HashMap<String, FieldValue>();

FieldValue fv = new FieldValue();
fv.setType(FieldType.SINGLE_LINE_TEXT);
fv.setValue("sample_updateRecordById");

record.put("FieldCode1", fv);

UpdateRecordResponse response = kintoneRecordManager.updateRecordByID(appID, recordID, record, revision);

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 RecordUpdateKey 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 HashMap<String, FieldValue> 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

UpdateRecordResponse

Sample code

Update record by UpdateKey Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute UPDATE RECORD API
Integer appID = 1;
HashMap<String, FieldValue> record = new HashMap<String, FieldValue>();
RecordUpdateKey uKey = new RecordUpdateKey("文字列__1行__0", "unique_value1");
Integer revision = 1;

FieldValue fv = new FieldValue();
fv.setType(FieldType.SINGLE_LINE_TEXT);
fv.setValue("sample_updateRecordByUpdateKey");

record.put("FieldCode1", fv);

UpdateRecordResponse response = kintoneRecordManager.updateRecordByUpdateKey(appID, uKey, record, revision);

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 ArrayList<RecordUpdateItem> 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

UpdateRecordsResponse

Sample code

Update multi records Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute UPDATE RECORDS API
Integer appID = 1;
HashMap<String, FieldValue> record1 = new HashMap<String, FieldValue>();
HashMap<String, FieldValue> record2 = new HashMap<String, FieldValue>();

FieldValue fv1 = new FieldValue();
fv1.setType(FieldType.SINGLE_LINE_TEXT);
fv1.setValue("test_updateRecords1");

FieldValue fv2 = new FieldValue();
fv2.setType(FieldType.SINGLE_LINE_TEXT);
fv2.setValue("test_updateRecords2");

record1.put("FieldCode1", fv1);
record2.put("FieldCode1", fv2);

ArrayList<RecordUpdateItem> records = new ArrayList<RecordUpdateItem>();
records.add(new RecordUpdateItem(1, null, null, record1));
records.add(new RecordUpdateItem(2, null, null, record2));

UpdateRecordsResponse response = kintoneRecordManager.updateRecords(appID, records);

deleteRecords(app, ids)

Deletes multiple records in an app.

Parameter

Name Type Required Description
app Integer yes The kintone app ID
ids ArrayList<Integer> yes The list ids of record will be delete.

Return

(none)

Sample code

Delete multi record Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute DELETE RECORDS API
Integer appID = 1;
ArrayList<Integer> ids = new ArrayList<Integer>();
ids.add(1);
ids.add(2);

kintoneRecordManager.deleteRecords(appID, ids);

deleteRecordsWithRevision(app, idsWithRevision)

Deletes multiple records in an app with revision.

Parameter

Name Type Required Description
app Integer yes The kintone app ID
idsWithRevision HashTable<Integer, Integer> yes (key: The Id of record, value: The Revision of record.)

Return

(none)

Sample code

Delete record with revision Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute DELETE RECORDS API
Integer appID = 1;
HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>();

idsWithRevision.put(1, 1);
idsWithRevision.put(2, null);
idsWithRevision.put(3, -1);

kintoneRecordManager.deleteRecordsWithRevision(appID, idsWithRevision);

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 ArrayList<String> yes The user code(s) of the assignee(s)
revision Integer (option) The revision number of record

Return

UpdateRecordResponse

Sample code

update record Assignees Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute UPDATE RECORD API
Integer appID = 1;
Integer recordID =1;
ArrayList<String> assignees = new ArrayList<String>();
assignees.add("sample_user");
Integer revision = 1;

UpdateRecordResponse response = kintoneRecordManager.updateRecordAssignees(appID, recordID, assignees, revision);

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

UpdateRecordResponse

Sample code

Update record status Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute UPDATE RECORD API
Integer appID = 1;
Integer recordID =1;
String assignee = "sample_user";
String action = "処理開始";
Integer revision = 1;

UpdateRecordResponse response = kintoneRecordManager.updateRecordStatus(appID, recordID, action, assignee, revision);

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 ArrayList<RecordUpdateStatusItem> yes The recod status data. See belowsample codee or reference at the end of this page to know format.

Return

UpdateRecordsResponse

Sample code

Update multi record status Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute UPDATE RECORDS API
Integer appID = 1;
ArrayList<RecordUpdateStatusItem> rusi = new ArrayList<RecordUpdateStatusItem>();

String action = "処理開始";
String assignee = "sample_user1";
Integer recordID1 =1;
Integer recordID2 =2;
Integer recordID3 =3;
Integer revision1 = 1;
Integer revision2 = null;
Integer revision3 = -1;

rusi.add(new RecordUpdateStatusItem(action, assignee, recordID1, revision1));
rusi.add(new RecordUpdateStatusItem(action, assignee, recordID2, revision2));
rusi.add(new RecordUpdateStatusItem(action, assignee, recordID3, revision3));
UpdateRecordsResponse response = kintoneRecordManager.updateRecordsStatus(appID, rusi);

getComments(app, record, order, offset, limit)

Parameter

Name Type Required Description
app Integer yes The kintone app ID
record Integer yes The kintone app ID
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

GetCommentsResponse

Sample code

Get comments Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute GET RECORD_COMMENTS  API
Integer appID = 1;
Integer recordID = 1;
String order = "asc";
Integer offsset = 1;
Integer limit = 2;

GetCommentsResponse response = kintoneRecordManager.getComments(appID, recordID, order, offsset, limit);

addComment(app, record, comment)

Parameter

Name Type Required Description
app Integer yes The kintone app ID
record Integer yes The kintone app ID
comment CommentContent yes About the format, please look the sample below or reference at the end of this page.

Return

AddCommentResponse

Sample code

Add comment Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute ADD RECORD_COMMENT  API
Integer app = 1;
Integer record = 1;
CommentContent comment = new CommentContent();
ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>();
CommentMention mention = new CommentMention();
mention.setCode("sample_user");
mention.setType("USER");
mentionList.add(mention);
comment.setText("test comment");
comment.setMentions(mentionList);

AddCommentResponse response = kintoneRecordManager.addComment(app, record, comment);

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

(none)

Sample code

Delete comment Source code
String USERNAME = "YOUR_USERNAME";
String PASSWORD = "YOUR_PASSWORD";

// Init authenticationAuth
Auth kintoneAuthWithPassword = new Auth();
kintoneAuthWithPassword.setPasswordAuth(USERNAME, PASSWORD);

// Init Connection without "guest space ID"
Connection kintoneOnDemoDomain = new Connection("sample.domain.dot", kintoneAuthWithPassword);

// Init Record Module
Record kintoneRecordManager = new Record(kintoneOnDemoDomain);

// execute DELETE RECORD_COMMENT API
Integer app = 1;
Integer record = 1;
Integer comment = 1;

kintoneRecordManager.deleteComment(app, record, comment);

getAllRecordsByQuery(app, query, fields, totalCount)

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 ArrayList<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

GetRecordsResponse

Sample code

Get all records by query Source code
    Integer appID = {YOUR_APP_ID};
    String query = {YOUR_QUERY};
    ArrayList<String> fields = new ArrayList<String>();
    GetRecordsResponse getAllRecords = kintoneRecordManager.getAllRecordsByQuery(appID, query, fields);

deleteAllRecordsByQuery(Integer app, String query)

Delete all records by indicating query. 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. If nothing is specified, fields will be returned from all accessible records. The query detail can't indicate limit and offset.

Return

(none)

Sample code

Delete all records by query Source code
Integer appID = 114;
String query = "$id >=" +  1 + "and $id <=" + 10 + "order by $id asc";
try {
    // Init Record Module
    Record kintoneRecord = new Record(kintoneConnection);
    BulkRequestResponse bulkRequestResponse = kintoneRecord.deleteAllRecordsByQuery(appID, query);
} catch (BulksException e) {
    System.out.println(e.getResults());
    // Ex: If User delete 6000 records:
    // Case 1: If there error occur in record 0
    // Err response:
    // [KintoneAPIException]
    // Case 2: the error occur in record 4000
    // err response
    // [
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    BulkRequestResponse,
    //    KintoneAPIException
    //  ]
}

updateAllRecords(Integer app, ArrayList<RecordUpdateItem> records)

Update all records to the kintone app

Parameter

Name Type Required Description
app Integer yes The kintone app ID
records Array<RecordUpdateItem> yes The records data which will update to kintone app

Return

(none)

Sample code

update all records Source code
Integer appID = 114;
HashMap <String, FieldValue> record = new HashMap();

FieldValue fv = new FieldValue();
fv.setType(FieldType.SINGLE_LINE_TEXT);
fv.setValue("test_updateRecords3x");

record.put("文字列__1行", fv);

ArrayList<RecordUpdateItem> records = new ArrayList<RecordUpdateItem>();
records.add(new RecordUpdateItem(58178, null, null, record));
try {
    BulkRequestResponse bulkRequestResponse = this.passwordAuthRecordManagerment.updateAllRecords(appID, records);
    UpdateRecordsResponse updateRecordsResponse =  (UpdateRecordsResponse) bulkRequestResponse.getResults().get(0);
    System.out.println("record ID: " + updateRecordsResponse.getRecords().get(0).getID());
    System.out.println("revision: " + updateRecordsResponse.getRecords().get(0).getRevision());
    /*
    output:
        record ID: 58178   // record ID
        revision: 5  // revision
    */
} catch (BulksException e) {
    System.out.println(e.getResults());

    // Ex: If User update 6000 records:
    // Case 1: If there error occur in record 0
    // Err response:
    // [KintoneAPIException]
    // Case 2: the error occur in record 4000
    // err response
    // [
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    UpdateRecordsResponse,
    //    KintoneAPIException
    //  ]
}

addAllRecords(Integer app, ArrayList<HashMap<String, FieldValue>> records)

Add all records to the kintone app

Parameter

Name Type Required Description
app Integer yes The kintone app ID
records Array<HashTable<String, FieldValue>> yes The records data which will add to kintone app

Return

(none)

Sample code

update all records Source code
Integer appID = 114;
ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>();

HashMap<String, FieldValue> record = new HashMap<String, FieldValue>();

FieldValue fv = new FieldValue();
fv.setType(FieldType.SINGLE_LINE_TEXT);
fv.setValue("test_updateRecords3x");

record.put("文字列__1行", fv);
records.add(record);
try {
    BulkRequestResponse bulkRequestResponse = this.passwordAuthRecordManagerment.addAllRecords(appID, records);
    AddRecordsResponse addRecordsResponse =  (AddRecordsResponse) bulkRequestResponse.getResults().get(0);
    System.out.println("record ID: " + addRecordsResponse.getIDs().get(0));
    System.out.println("revision: " + addRecordsResponse.getRevisions().get(0));
    /*
    output:
        record ID: 58179   // record ID
        revision: 1  // revision
    */
} catch (BulksException e) {
    System.out.println(e.getResults());

    // Ex: User update 6000 records:
    // Case 1: If there error occur in record 0
    // err response:[KintoneAPIException]

    // Case 2: the error occur in record 4000
    // err response:
    //  [
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    AddRecordsResponse,
    //    KintoneAPIException
    //  ]
}

upsertRecord(app, updateKey, record, revision)

Parameter

Name Type Required Description
app Integer yes The kintone app ID
updateKey RecordUpdateKey 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 HashMap<String, FieldValue> 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

AddRecordResponse or UpdateRecordResponse

Sample code

Upsert record Source code

    Integer appID = {YOUR_APP_ID};
    FieldValue fv = new FieldValue();
    fv.setType(FieldType.SINGLE_LINE_TEXT);
    fv.setValue( {YOUR_FIELD_VALUE} );

    HashMap<String, FieldValue> record = new HashMap<String, FieldValue>();
    record.put("title", fv);

    RecordUpdateKey updateKey = new RecordUpdateKey("detail", "update 123");

    kintoneRecordManager.upsertRecord(appID, updateKey, record, 1);

upsertRecords(app, updateKey, records, revision)

Parameter

Name Type Required Description
app Integer yes The kintone app ID
records ArrayList<RecordUpdateItem> 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

BulkRequestResponse

Sample code

Upsert records Source code

    Integer appID = {YOUR_APP_ID};
    ArrayList<RecordsUpsertItem> upsertRecords = new ArrayList<RecordsUpsertItem>();

    ArrayList<HashMap<String, FieldValue> > records = new ArrayList<HashMap<String, FieldValue> >();

    FieldValue fv = new FieldValue();
    fv.setType(FieldType.SINGLE_LINE_TEXT);
    fv.setValue("Title 123");

    HashMap<String, FieldValue> record = new HashMap<String, FieldValue>();
    record.put("title", fv);

    RecordUpdateKey updateKey = new RecordUpdateKey("title", "update 123");

    upsertRecords.add(new RecordsUpsertItem(updateKey, record));
    kintoneRecordManager.upsertRecords(appID, upsertRecords);

Reference