Skip to content

kintoneAPIException

Handle error responses from kintone Rest API

Methods

getHttpErrorCode()

Parameter

(none)

Return

int

Sample code

Get http error code Source code
String appId = 1
Integer id = -1
try {
    GetRecordResponse response = recordManagerment.getRecord(appId, id);
} catch(kintoneException ke) {
    int errorCode = ke.getHttpErrorCode();
}

getErrorResponse()

Parameter

(none)

Return

ErrorResponse

Sample code

Get apps with error response Source code
String appId = 1
Integer id = -1
try {
    GetRecordResponse response = recordManagerment.getRecord(appId, id);
} catch(kintoneException ke) {
    String id = ke.getErrorResponse().getId();
    String message = ke.getErrorResponse().getMessage();
    String code = ke.getErrorResponse().getCode();
}

getErrorResponses()

Parameter

(none)

Return

ArrayList<ErrorResponse>

Sample code

Get apps with error responses Source code
String appId = 1
Integer id = -1

HashMap record = new HashMap();
FieldValue fv = new FieldValue();
fv.setType(FieldType.SINGLE_LINE_TEXT);
fv.setValue("test_AddRecord");

BulkRequest bulkRequestManager = new BulkRequest(connection);
bulkRequestManager.addRecord(appId, record);
try {
    BulkRequestResponse responses = bulkRequestManager.execute();
} catch(kintoneException ke) {
    for(ErrorResponse errorResponse : ke.getErrorResponses()) {
        String id = errorResponse.getId();
        String message = errorResponse.getMessage();
        String code = errorResponse.getCode();
    }
}