"revertTransactionToSavepoint"
JSON DB "revertTransactionToSavepoint"
action undoes a transaction to a previously created savepoint
The "revertTransactionToSavepoint"
action reverts a transaction to a savepoint previously created by "createTransactionSavepoint"
. It 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 request
{ "api": "db", "action": "revertToTransactionSavepoint", "params": { "transactionId": "replaceWithTransactionIdFromCreateTransaction", "transactionSavepointId": 1 }, "authToken": "replaceWithAuthtokenFromCreateSession" }
{ "api": "db", "action": "revertToTransactionSavepoint", "params": { "transactionId": "replaceWithTransactionIdFromCreateTransaction", "transactionSavepointId": 1 }, "responseOptions": {}, "authToken": "replaceWithAuthtokenFromCreateSession", "apiVersion": "1.0", "requestId": "2", "debug": "max" }
{ "authToken": "authToken", "errorCode": 0, "errorMessage": "" }
Use the revertTransactionToSavepoint JSON API action to undo a transaction to a previously created savepoint
The "params"
property is an object that contains an action's parameters. Each action defines its own required and optional properties.
Properties summary
"params"
properties summaryProperty | Description | Default | Type | Limits (inclusive) |
---|---|---|---|---|
specifies a server-generated ID that represents a transaction |
| string | 0 to 255 bytes | |
specifies a server-generated ID that represents a savepoint |
| string | 0 to 255 bytes |
The "transactionId"
is an option string that the server generates in order to return during a "createTransaction"
action. The generated ID represents a transaction. It defaults to an empty string.
When a client wants an action to be under control of a transaction, it must include the
"transactionId"
in the action.A
"transactionId"
is valid and can be applied to many actions until it is either committed using"commitTransaction"
or rolled back using the"rollbackTransaction"
.A zero-length string mean the
"transactionId"
is invalid.Do not assume that
"transactionId"
is a number embedded in a string.
The "transactionSavepointId"
is an optional string that the server generates in order to return during a "createTransactionSavepoint"
action. The generated ID represents a savepoint. 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 means the
"transactionSavepointId"
is invalid.Do not assume that the
"transactionSavepointId"
is a number embedded in a string.