Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Status
titleGET
 Get the current status of the repository in a transaction

Example:

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

Response:

Code Block
Status: 200 OK
 
Headers:
Link: http<http://localhost:8080/rest/tx:86dd0891-d975-42d8-8837-a24ad6041b59?limit=-1&amp;offset=0>;rel="firstcanonical"

Body:
Same as non-transaction response.

 

Status:

Status
subtletrue
colourGreen
title200
OK: If the request was successful

Status
subtletrue
colourRed
title410
Gone: Transaction not found



Status
colourBlue
titlePOST
Create a new transaction

Info

After retrieving a transaction resource, the client can execute any REST API method prefixed by the transaction location.

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/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 the base URL 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.

Code Block
curl -X POST "http://localhost:8080/rest/tx:83e34464-144e-43d9-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"

Status:

Status
subtletrue
colourGreen
title201
  Created: if the transaction is created successfully

 



Status
colourBlue
titlePOST
Keep an existing transaction alive

 

Example:

Code Block
curl -i -X POST "http://localhost:8080/rest/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
Expires: Sat, 16 Nov 2013 03:35:43 GMT


Status:

Status
subtletrue
colourGreen
title204
  No Content: if the transaction is renewed successfully

Status
subtletrue
colourRed
title410
  Gone: if the transaction doesn't exist

 


Status
colourBlue
titlePOST
 Save 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:

Code Block
curl -i -X POST "http://localhost:8080/rest/tx:123456789/fcr:tx/fcr:commit" 

Response:

Code Block
Status: 204 No Content

Status:

Status
subtletrue
colourGreen
title204
 No Content: if the transaction is committed successfully

Status
subtletrue
colourRed
title410
Gone: if the transaction doesn't exist

 


Status
colourBlue
titlePOST
 Rollback Rollback and close an open transaction

Example:

Code Block
curl -i -X POST "http://localhost:8080/rest/tx:123456789/fcr:tx/fcr:rollback" 

Response:

Code Block
Status: 204 No Content

Status:

Status
subtletrue
colourGreen
title204
 No Content: if the transaction is discarded successfully

Status
subtletrue
colourRed
title410
Gone: if the transaction doesn't exist