OverviewFedora supports the ability to wrap multiple REST API calls into a single transaction that can be committed or rolled back as an atomic operation.
After retrieving a transaction resource using the RESTful HTTP API - Transactions, clients can send additional REST API calls within the scope of that transaction. After committing the transaction, the pending changes will be persisted in a single atomic operation. The updates related to a given transaction are only visible within that transaction scope. Event-driven workflows are not triggered until the transaction is committed. Transactions can also be rolled back on-demand or based on a configurable timeout duration, leaving the repository in the state as if the transaction had never occurred.
Create a transaction:
In the response, the Location header will contain a path to the transaction URI:
The expires header indicates when the transaction will be automatically rolled back
Transactions are automatically closed and rolled back after 3 minutes. Transactions can be refreshed by POSTing to the transaction URI returned in the "Location" header of the initial creation request.
See Application Configuration for setting a different session duration.
The following API methods on repository resources can be called within the scope of a transaction: PUT, POST, PATCH, GET, and DELETE .
In order to make a request within the transaction, include the Transaction URI in the "Atomic-ID" request header:
To get the status of a transaction, perform a GET request on the Transaction URI:
Until the transaction is committed, no other client will see the changes made within the scope of the transaction. After committing, the changes will be applied to the repository, associated events will be emitted, and all clients will be able to see the change(s).
To commit a transaction, perform a PUT request on the Transaction URI:
To rollback a transaction, perform a DELETE request on the Transaction URI:
Note: Rolling back a transaction will result in the changes made within the scope of the transaction to be erased, and the transaction closed and removed.
After committing or rolling back a transaction, it is closed, and any further operations on that transaction will be rejected.