Create a new transaction Info |
---|
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. |
Warning |
---|
Transactions are automatically closed and rolled back after 3 minutes of inactivity. Transactions can be refreshed by POSTing to the transaction URI |
Example: Code Block |
---|
curl -i -X POST "http://localhost:8080/rest/fcr:tx" |
Response: Code Block |
---|
Status: 201 Created
Headers:
Location: http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb
Expires: Thu, 07 May 2020 17:34:37 GMT |
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: Status |
---|
subtle | true |
---|
colour | Green |
---|
title | 201 |
---|
| Created: if the transaction is created successfully
Get the current status of the repository in a transactionTo 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: Code Block |
---|
curl -i -X GET "http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb" |
Response: Code Block |
---|
Status: 204 No Content
Atomic-Expires: Thu, 7 May 2020 17:46:17 GMT |
Status: Status |
---|
| |
---|
subtle | true |
---|
colour | Green |
---|
title | 204 |
---|
| No Content: If the request was successful Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | 404 |
---|
| Not Found: Transaction not found
Keep an existing transaction alive
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: Code Block |
---|
curl -i -X POST "http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb" |
Response: Code Block |
---|
Status: 204 No Content
Headers:
Atomic-Expires: Thu, 7 May 2020 18:00:38 GMT |
Status: Status |
---|
| |
---|
subtle | true |
---|
colour | Green |
---|
title | 204 |
---|
| No Content: if the transaction is renewed successfully Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | 404 |
---|
| Not Found: if the transaction doesn't exist
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.
Example: Code Block |
---|
curl -X PUT "http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb/commit" |
Response: Code Block |
---|
Status: 204 No Content |
Status: Status |
---|
| |
---|
subtle | true |
---|
colour | Green |
---|
title | 204 |
---|
| No Content: if the transaction is committed successfully Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | 404 |
---|
| Not Found: if the transaction doesn't exist
Rollback and close an open transactionExample: Code Block |
---|
curl -i -X DELETE "http://localhost:8080/rest/fcr:tx/ce4bb2bf-8ced-4c7d-b281-f2132e3064bb" |
Response: Code Block |
---|
Status: 204 No Content |
Status: Status |
---|
| |
---|
subtle | true |
---|
colour | Green |
---|
title | 204 |
---|
| No Content: if the transaction is discarded successfully Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | 410 |
---|
| Gone: if the transaction has already been committed or rolled back Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | 404 |
---|
| Not Found: if the transaction does not exist |