revertTransactionToSavepoint

JSON DB "revertTransactionToSavepoint" action undoes a transaction to a previously created savepoint

This action undoes all transaction changes made after the savepoint and keeps the transaction open to allow more actions to run inside the transaction.

Important JSON DB API does not support "revertTransactionToSavepoint" when the transaction contains a call to "getRecordsUsingSQL" or "runSqlStatements"; instead, the JSON DB API returns an error.

The JSON DB API does support "rollbackTransaction" and "commitTransaction" when the transaction contains "getRecordsUsingSQL" or "runSqlStatements".

  • All transactions after the savepoint are permanently discarded, and changes up to the savepoint still need to be committed. This can undo changes to records, tables, indexes, etc.
  • This action cannot be undone.
  • This action does not close a transaction.
  • Additional commands can continue to be executed under transaction control.
  • To commit all changes up to the savepoint, call the "commitTransaction" command.
  • A transaction can only be closed by "commitTransaction" or "rollbackTransaction".

 

Request examples

Minimal

{
  "action": "revertToTransactionSavepoint",
  "params": {
    "transactionId": "replaceWithTransactionIdFromCreateTransaction",
    "transactionSavepointId": 1
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

Maximal

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

 

 

 

Response examples

Success

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

Maximal

{
  "authToken": "replaceWithAuthTokenFromCreateSession",
  "requestId": "00000002",
  "debugInfo": {
    "request": {
      "authToken": "replaceWithAuthTokenFromCreateSession",
      "api": "db",
      "action": "revertToTransactionSavepoint",
      "params": {
        "transactionId": "replacedWithValidTransactionId",
        "transactionSavepointId": 1
      },
      "requestId": "00000002",
      "debug": "max"
    }
  },
  "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