Old Release

This documentation covers an old version of Fedora. Looking for another version? See all documentation.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »


Request URI: /fcr:tx; /fcr:tx/{transaction_id}

Methods: GET, POST, PUT, DELETE

GET  Get the current status of the repository in a transaction

Example:

curl -i "http://localhost:8080/rest/fcr:tx/86dd0891-d975-42d8-8837-a24ad6041b59"

Response:

Status: 204 NO CONTENT
 
Atomic-Expires: Sat, 16 Nov 2013 00:32:57 GMT


Status:

204 No Content: If the request was successful

404 Not Found: Transaction doesn't exist

410 Gone: Transaction expired



POST Create a new transaction

After retrieving a transaction resource, the client can execute any REST API method with the transaction resource sent in the Atomic-ID header.

Transactions are automatically closed and rolled back after 3 minutes of inactivity. Transactions can be refreshed by POSTing to /rest/fcr:tx/{tx:id}


Example:

curl -i -X POST "http://localhost:8080/rest/fcr:tx" 

Response:

Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/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 performing REST API operations within the transaction.  When you are done with the transaction, either PUT to the transaction location to commit the transaction to the repository or DELETE the transaction location to discard the changes.

curl -X POST -H"Atomic-ID: http://localhost:8080/rest/fcr: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/fcr:tx/83e34464-144e-43d9-af13-b3464a1fb9b5" "http://localhost:8080/rest/path/to/resource/to/delete"
curl -X PUT "http://localhost:8080/rest/fcr:tx/83e34464-144e-43d9-af13-b3464a1fb9b5"

Status:

201  Created: if the transaction is created successfully




POST Keep an existing transaction alive


Example:

curl -i -X POST "http://localhost:8080/rest/fcr:tx/83e34464-144e-43d9-af13-b3464a1fb9b5" 

Response:

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:

204  No Content: if the transaction is renewed successfully

404 Not Found: Transaction doesn't exist

410 Gone: Transaction expired



POST Save and 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:

curl -i -X PUT "http://localhost:8080/rest/fcr:tx/123456789" 

Response:

Status: 204 No Content

Status:

204 No Content: if the transaction is committed successfully

404 Not Found: Transaction doesn't exist

409 Conflict: Transaction did not commit successfully

410 Gone: Transaction expired



POST Rollback and close an open transaction

Example:

curl -i -X DELETE "http://localhost:8080/rest/fcr:tx/123456789" 

Response:

Status: 204 No Content

Status:

204 No Content: if the transaction is discarded successfully

404 Not Found: Transaction doesn't exist

409 Conflict: Transaction did not commit successfully

410 Gone: Transaction expired

  • No labels