commitTransaction

JSON DB "commitTransaction" action commits a transaction and, when successful, ensures all actions attached to the transaction have been completed successfully and durably

The "commitTransaction" action closes a transaction created by "createTransaction" and commits all changes made by actions attached to the transaction, ensuring that all changes are durable and visible to other transactions.

Optionally include the "transactionSavepointId" property to commit the transaction up to a specified save point.

  • "commitTransaction" uses the "transactionId" property returned from the "createTransaction" action to identify the transaction.
  • Once a transaction is committed or rolled back, you can no longer use the transaction’s "transactionId".
  • An error is returned when the "transactionId" property does not represent a transaction assigned to the current session.
  • If any part of a transaction cannot be committed, the "commitTransaction" action fails, and all changes in the transaction are rolled back as if they had never occurred.

 

Request examples

Minimal

{
  "action": "commitTransaction",
  "params": {
    "transactionId": "replaceWithTransactionIdFromCreateTransaction"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 
 

Maximal

{
  "api": "db",
  "action": "commitTransaction",
  "params":
  {
    "transactionId": "replaceWithTransactionIdFromCreateTransaction",
    "transactionSavepointId": "replaceWithTransactionSavepointIdFromCreateTransactionSavePoint"
  },
  "responseOptions": {},
  "apiVersion": "1.0",
  "requestId": "2",
  "debug": "max",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

 

 

Response examples

Minimal

{
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

Maximal

{
  "authToken": "gIL3PhAnoCshD3qZ2tMDd4IOODa0CMK1SEP7rp56CyPozvtxQPTqFNc0d0qUmMbq",
  "requestId": "00000004",
  "debugInfo": {
    "request": {
      "authToken": "gIL3PhAnoCshD3qZ2tMDd4IOODa0CMK1SEP7rp56CyPozvtxQPTqFNc0d0qUmMbq",
      "api": "db",
      "action": "commitTransaction",
      "params": {
        "transactionId": "mEKbpdNiN5tU1t32O35IfDr2I3ZRvJzddweZuU1al5FD9IfVXENLPgKqRzGMhoLX"
      },
      "requestId": "00000004",
      "debug": "max"
    },
    "serverSuppliedValues": {
      "databaseName": null,
      "ownerName": null
    },
    "errorData": {
      "errorData": null
    },
    "warnings": []
  },
  "errorCode": 0,
  "errorMessage": ""
}
 
 

 

Request properties ("params")

Property Description Default Type Limits (inclusive)

transactionId

The "transactionId" property identifies a transaction in which the specified action will be included. Optional with default of "" string 0 to 255 bytes

transactionSavepointId

The "transactionSavepointId" property is generated by the server. The generated ID represents a point in a transaction's progress. In requests, it defaults to an empty string.

  • A transaction savepoint represents the current point in the transaction process.
  • A client can roll back a transaction to any savepoint by calling the "rollbackTransaction" action with the desired "transactionSavepointId" property.
  • A client can commit a transaction to any savepoint by calling the "commitTransaction" action with the desired "transactionSavepointId" property.
  • A zero-length string returned in a response means the "transactionSavepointId" provided in the request is invalid.
  • Do not assume that the "transactionSavepointId" is a number in a string.

Optional with default of ""

string 0 to 255 bytes