Request URI: /fcr:tx; /tx:{transaction_id}/path/to/resource, /tx:{transaction_id}/fcr:tx, /tx:{transaction_id}/fcr:commit, /tx:{transaction_id}/fcr:rollback
Methods: GET, POST Get the current status of the repository in a transactionExample: Code Block |
---|
curl -i "http://localhost:8080/rest/tx:86dd0891-d975-42d8-8837-a24ad6041b59" |
Response: Code Block |
---|
Status: 200 OK
Link: <http://localhost:8080/rest/>;rel="canonical"
Body:
Same as non-transaction response. |
Status: Status |
---|
subtle | true |
---|
colour | Green |
---|
title | 200 |
---|
| OK: If the request was successful Status |
---|
subtle | true |
---|
colour | Red |
---|
title | 410 |
---|
| Gone: Transaction not found Create a new transaction Info |
---|
After retrieving a transaction resourceURI 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 prefixed within the transaction scope by including the transaction locationURI 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 /rest/{tx:id}/fcr:tx |
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:83e34464/ce4bb2bf-144e8ced-43d94c7d-af13b281-b3464a1fb9b5f2132e3064bb
Atomic-Expires: SatThu, 1607 NovMay 20132020 0017:3234:5737 GMT |
Usage: When a transaction has been created, it will return a Location header. Use this location (transaction URI) as the base URL value of the "Atomic-ID" request header for performing REST API operations within the transaction. When you are done with the transaction, either append "/fcr:tx/fcr: commit " to commit the transaction to the repository or "/fcr:tx/fcr:rollback" to discard the changes.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 POSTGET "http://localhost:8080/rest/fcr:tx:83e34464/ce4bb2bf-144e8ced-43d94c7d-af13-b3464a1fb9b5/path/to/object/to/create"
curl -X DELETE "http://localhost:8080/rest/tx:83e34464-144e-43d9-af13-b3464a1fb9b5/path/to/resource/to/delete"
curl -X POST "http://localhost:8080/rest/tx:83e34464-144e-43d9-af13-b3464a1fb9b5/fcr:tx/fcr:commit"b281-f2132e3064bb" |
Response: Code Block |
---|
Status: 204 No Content
Headers:
Expires: Thu, 7 May 2020 17:46:17 GMT |
Status: Status |
---|
| |
---|
subtle | true |
---|
colour | Green |
---|
title | 201204 |
---|
| Created No Content: if the transaction is created successfully If the request was successful Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | 404 |
---|
| Not Found: Transaction not found
Status |
---|
subtle | true |
---|
colour | Red |
---|
title | 410 |
---|
| Gone: Transaction expired
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:83e34464/ce4bb2bf-144e8ced-43d94c7d-af13-b3464a1fb9b5/fcr:tx" b281-f2132e3064bb" |
Response: Code Block |
---|
Status: 204 No Content
Headers:
Location: http://localhost:8080/rest/tx:83e34464-144e-43d9-af13-b3464a1fb9b5
Atomic-Expires: SatThu, 167 NovMay 20132020 0318:3500:4338 GMT |
Status: Status |
---|
| |
---|
subtle | true |
---|
colour | Green |
---|
title | 204 |
---|
| No Content: if the transaction is renewed successfully Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | 410404 |
---|
| GoneNot Found: if the transaction doesn't exist Status |
---|
subtle | true |
---|
colour | Red |
---|
title | 410 |
---|
| Gone: Transaction expired
POSTSave and commit 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 -i -X POSTPUT "http://localhost:8080/rest/tx:123456789/fcr:tx/fcr:commit" 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 committed successfully Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | 410404 |
---|
| Gone Not Found: if the transaction doesn't exist Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | 409 |
---|
| Conflict: Transaction did not commit successfully Status |
---|
subtle | true |
---|
colour | Red |
---|
title | 410 |
---|
| Gone: Transaction expired
POST Rollback and close an open transactionExample: Code Block |
---|
curl -i -X POSTDELETE "http://localhost:8080/rest/tx:123456789/fcr:tx/fcr:rollback" 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 doesn't does not exist |