Table of Contents |
---|
Excerpt | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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, PUT, DELETE
Status |
|
Code Block |
---|
curl -i "http://localhost:8080/rest/fcrtx:tx/86dd0891-d975-42d8-8837-a24ad6041b59" |
Response:
Code Block |
---|
Status: 204200 NO CONTENTOK Atomic-Expires: Sat, 16 Nov 2013 00:32:57 GMT Link: <http://localhost:8080/rest/>;rel="canonical" Body: Same as non-transaction response. |
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Statuscolour Blue title POST
Create a new transaction
colour | Blue |
---|---|
title | POST |
Info |
---|
After retrieving a transaction resource, the client can execute any REST API method with prefixed by the transaction resource sent in the Atomic-ID headerlocation. |
Warning |
---|
Transactions are automatically closed and rolled back after 3 minutes of inactivity. Transactions can be refreshed by POSTing to /rest/fcr:tx/{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/fcrtx:tx/83e34464-144e-43d9-af13-b3464a1fb9b5 Expires: Sat, 16 Nov 2013 00:32:57 GMT |
Usage:
When a transaction has been created, it will return a Location header. Use this location as Atomic-ID header when the base URL for performing REST API operations within the transaction. When you are done with the transaction, either PUT to the transaction location append "/fcr:tx/fcr:commit" to commit the transaction to the repository or DELETE the transaction location "/fcr:tx/fcr:rollback" to discard the changes.
Code Block |
---|
curl -X POST -H"Atomic-ID: http://localhost:8080/rest/fcrtx:tx/83e34464-144e-43d9-af13-b3464a1fb9b5" "http://localhost:8080/rest/path/to/object/to/create" curl -X DELETE -H"Atomic-ID: http://localhost:8080/rest/fcrtx:tx/83e34464-144e-43d9-af13-b3464a1fb9b5" "http://localhost:8080/rest/path/to/resource/to/delete" curl -X PUTPOST "http://localhost:8080/rest/fcrtx:tx/83e34464-144e-43d9-af13-b3464a1fb9b5/fcr:tx/fcr:commit" |
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
Statuscolour Blue title POST
Keep an existing transaction alive
colour | Blue |
---|---|
title | POST |
Example:
Code Block |
---|
curl -i -X POST "http://localhost:8080/rest/fcrtx:tx/83e34464-144e-43d9-af13-b3464a1fb9b5/fcr:tx" |
Response:
Code Block |
---|
Status: 204 No Content
Headers:
Location: http://localhost:8080/rest/tx:83e34464-144e-43d9-af13-b3464a1fb9b5
Atomic-Expires: Sat, 16 Nov 2013 03:35:43 GMT |
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status colour Blue title
PUTcolour | Blue |
---|---|
title |
POST
Save and commit an open transaction
POST |
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 PUTPOST "http://localhost:8080/rest/tx:123456789/fcr:tx/123456789fcr:commit" |
Response:
Code Block |
---|
Status: 204 No Content |
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status colour Blue title
DELETEcolour | Blue |
---|---|
title |
POST
Rollback and close an open transaction
POST |
Example:
Code Block |
---|
curl -i -X DELETEPOST "http://localhost:8080/rest/tx:123456789/fcr:tx/123456789fcr:rollback" |
Response:
Code Block |
---|
Status: 204 No Content |
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|