Although very similar, the Fedora 6 Transactions API is not backwards compatible with previous versions
This API is an implementation of the Fedora Atomic Batch Operations Specification After retrieving a transaction URI from the "Location" header in the response to the following HTTP request, the client can execute any POST/PUT/PATCH/DELETE/GET REST API method within the transaction scope by including the transaction URI in the "Atomic-ID" request header. Transactions are automatically closed and rolled back after 3 minutes of inactivity. Transactions can be refreshed by POSTing to the transaction URI Example: Response: Usage: When a transaction has been created, it will return a Location header. Use this location (transaction URI) as the value of the "Atomic-ID" request header for performing REST API operations within the transaction. When you are done with the transaction, either commit the transaction to the repository by making a PUT request to the transaction URI, or discard the changes and rollback the transaction by making a DELETE request to the transaction URI. For further examples of the usage of Transactions, see: Transactions Status: 201 Created: if the transaction is created successfully To get the status of a transaction, perform a GET request on the transaction URI that was previously returned as the value of the "Location" header from the transaction creation request. The "Atomic-Expires" header indicates the time at which the transaction will auto-rollback. Example: Response: Status: 204 No Content: If the request was successful 404 Not Found: Transaction not found 410 Gone: Transaction expired By performing a POST request on an existing transaction URI, the transaction's expiration time is extended by the value of the session timeout duration (default: 3 minutes) Example: Response: Status: 204 No Content: if the transaction is renewed successfully 404 Not Found: if the transaction doesn't exist 410 Gone: Transaction expired Example: Response: Status: 204 No Content: if the transaction is committed successfully 404 Not Found: if the transaction doesn't exist 409 Conflict: Transaction did not commit successfully 410 Gone: Transaction expired Example: Response: Status: 204 No Content: if the transaction is discarded successfully 410 Gone: if the transaction has already been committed or rolled back 404 Not Found: if the transaction does not exist POST Create a new transaction
curl -i -X POST "http://localhost:8080/rest/fcr:tx"
Status: 201 Created
Headers:
Location: http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb
Atomic-Expires: Thu, 07 May 2020 17:34:37 GMT
GET Get the current status of the repository in a transaction
curl -i -X GET "http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb"
Status: 204 No Content
Headers:
Expires: Thu, 7 May 2020 17:46:17 GMT
POST Keep an existing transaction alivecurl -i -X POST "http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb"
Status: 204 No Content
Headers:
Atomic-Expires: Thu, 7 May 2020 18:00:38 GMT
PUT Commit an open transaction
Any operations you made within the scope of the transaction will be applied together, meaning if any of them fail, the whole transaction will fail.curl -X PUT "http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb"
Status: 204 No Content
DELETE Rollback and close an open transaction
curl -i -X DELETE "http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb"
Status: 204 No Content