Skip to main content
Version: 5.11.4

TransactionWriteV2

public BackendReturnObject TransactionWriteV2(ListTransactionValue[] transactionList);
public BackendReturnObject TransactionWriteV2(List<TransactionValue> transactionList);

Parameters

ValueTypeDescription
transactionListTransactionValue[] (Selection) Arrays transaction tasks
transactionListList<TransactionValue>(Selection) List where transaction tasks are stored

Description

Transaction commands existing in transactionList are requested to the server.

  • Up to 10 tasks can be grouped into 1 unit.
  • In the case of TransactionValue, which uses inDate for searching, you may only use the tasks of SetUpdateV2 and SetDeleteV2, instead of SetUpdate and SetDelete.
  • When at least one request in the task list has an error, all requests will fail.
  • For all requests to be handled as success, all requests must succeed.

Example

List< TransactionValue >

List<TransactionValue> transactionList = new List<TransactionValue>();

// Insert
Param param = new Param();
param.Add("name", "stat");
param.Add("level", 10);

transactionList.Add(TransactionValue.SetInsert("tableName", param));

//Modify
Where where = new Where();
where.Equal("name", "stat");

Param updateParam = new Param();
updateParam.Add("atk", 20);

transactionList.Add(TransactionValue.SetUpdate("tableName", where, updateParam));


// Delete
Where where2 = new Where();
where.Equal("name", "hero");

transactionList.Add(TransactionValue.SetDelete("tableName", where2));

//Modify/change data using your owner_inDate and rowInDate
string data_inDate = "2021-09-16T01:23:13.232Z";
transactionList.Add(TransactionValue.SetUpdateV2("tableName2", data_inDate, Backend.UserInDate, updateParam));
transactionList.Add(TransactionValue.SetDeleteV2("tableName2", data_inDate, BackendUserInDate));

Synchronous

Backend.GameData.TransactionWriteV2(transactionList);  

Asynchronous

Backend.GameData.TransactionWriteV2(transactionList, (callback) => 
{
// Post-process
});

SendQueue

SendQueue.Enqueue(Backend.GameData.TransactionWriteV2, transactionList, (callback) => 
{
// Post-process
});

Return cases

Success cases

When 'Insert' is included in the request and all requests are successful
statusCode : 200

returnValue : {"putItem":[{"table":"Name of the successfully inserted table","inDate":"inDate of the inserted table"}]} Example insertion of 5 tables): { "putItem": [ {"table":"publicTest","inDate":"2020-06-22T03:54:44.659Z"}, {"table":"publicTest","inDate":"2020-06-22T03:54:44.706Z"}, {"table":"publicTest","inDate":"2020-06-22T03:54:44.709Z"}, {"table":"privateTest","inDate":"2020-06-22T03:54:44.715Z"}, {"table":"privateTest","inDate":"2020-06-22T03:54:44.717Z"} ] }

When all requests are successful
statusCode : 204

Error cases

When an error occurs in at least 1 task while performing a transaction task An error corresponding to the error situation will be returned.
For the errors that occur during Insert/Update/Delete, refer to the developer documentation relevant to each error.

When 2 or more tasks are performed to the same row
statusCode : 400
errorCode : ValidationException

When there are over 10 tasks in transactionList, or when there are no tasks
statusCode : 400
errorCode : TransactionSizeError

When there is a task other than the Get command in transactionList
statusCode : 400
errorCode : TransactionDataError

When there is a modify/delete task in transactionList that uses inDate without the use of V2
statusCode : 400
errorCode : TransactionDataError

When the size of the data to be modified is over 4 MB/When the total number of columns to be modified is over 290
statusCode : 400
errorCode : ValidationException