Skip to main content

"revertTransactionToSavepoint" (JSON Action)

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

{
  "api": "db",
  "action": "revertToTransactionSavepoint",
  "params": {
    "transactionId": "replaceWithTransactionIdFromCreateTransaction",
    "transactionSavepointId": 1
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "api": "db",
  "action": "revertToTransactionSavepoint",
  "params": {
    "transactionId": "replaceWithTransactionIdFromCreateTransaction",
    "transactionSavepointId": 1
  },
  "responseOptions": {},
  "apiVersion": "1.0",
  "requestId": "2",
  "debug": "max",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "authToken": "replaceWithAuthTokenFromCreateSession",
  "requestId": "00000002",
  "debugInfo": {
    "request": {
      "authToken": "replaceWithAuthTokenFromCreateSession",
      "api": "db",
      "action": "revertToTransactionSavepoint",
      "params": {
        "transactionId": "replacedWithValidTransactionId",
        "transactionSavepointId": 1
      },
      "requestId": "00000002",
      "debug": "max"
    }
  },
  "errorCode": 0,
  "errorMessage": ""
}

Use the revertTransactionToSavepoint JSON API action to undo a transaction to a previously created savepoint

API actionsJSON DB APIJSON Actiontransaction actionsrevert transaction to save pointrevertTransactionToSavepoint

The "params" property is an object that contains an action's request parameters as defined by a set of properties. Each action defines its own required and optional properties. See System limits for a comprehensive overview of property requirements and limitations.

Table 1. revertTransactionToSavepoint"params" properties summary

Property

Description

Default

Type

Limits (inclusive)

transactionId

(optional) identifies a server-generated ID that represents a point in the progress of a transaction.

""

string

0 to 255 bytes

transactionSavepointId

(optional) specifies a string value that represents a point in a transaction that the server marks.

""

string

0 to 255 bytes



The "transactionId" is an optional string that the server generates and returns during a "createTransaction" action. The generated ID represents a transaction. In requests, it defaults to an empty string.

  • When a client wants an action to be controlled by a transaction, the "transactionId" must be included in the action request.

  • A "transactionId" is valid and can be applied to multiple actions until it is either committed using "commitTransaction" or rolled back using "rollbackTransaction".

  • A zero-length string means the "transactionId" is invalid.

  • Do not assume that "transactionId" is a number embedded in a string.

The "transactionSavepointId" is a string that the server generates and returns in a "createTransactionSavepoint" action. 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.