Migrated from Redmine #90 | Author: jasmine JJ Status: Resolved | Priority: High, I’m very impatient | Created: 2018-01-15
Hi guys,
I want to cancel a lot of booking at a time so I use cancelBatch method, right?.
I have read on document that I have to use
“@param Integer $id identifier of batch. See [[#createBatch|createBatch]] API method. @param Array $bookingIds ids of bookings included to batch. @return bool”
But when I put a list of bookingId I receive this error “SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (em_trancanh.sheduler_log, CONSTRAINT sheduler_log_ibfk_1 FOREIGN KEY (sheduler_id) REFERENCES sheduler (id))”,“data”:null},“id”:“2”,“jsonrpc”:“2.0”}"
however I put an object bookingId then I can cancel booking easily.
So could you please help me to find out what wrong here? Thank you.
!!
Here is the request when I execute my code.
{“jsonrpc”:“2.0”,“method”:“cancelBatch”,“id”:“5”,“params”:{“id”:“11”,“bookingIds”:[{“ids”:24}]}}.
This is my code
public boolean cancelBatch(String companyLogin, String endpoint, String token, String batchId, List bookingId)
throws SbmSDKException {
try {
String jsonResp = SbmExecute.executeWithUserToken(companyLogin, endpoint, token, "cancelBatch",
new CancelBatchReq(batchId, bookingId));
CancelBatchResp readValueForObject = SbmUtils.readValueForObject(jsonResp, CancelBatchResp.class);
return readValueForObject.isResult();
} catch (Exception e) {
throw new SbmSDKException(e.getMessage() + " during cancelBatch()", e);
}
}