Versions Compared

Key

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

Table of Contents

This API is an implementation of the Fedora Atomic Batch Operations Specification

Excerpt

Status
colour

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
 
Link: <http://localhost:8080/rest/>;rel="canonical"

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 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

 

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:83e34464/ce4bb2bf-144e8ced-43d94c7d-af13b281-b3464a1fb9b5f2132e3064bb
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 the 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.

Status:

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


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

To 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
Code Block
curl -X POST "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
 
Atomic-Expires: Thu, 7 May 2020 17:46:17 GMT


Status:

Status
subtletrue
colourGreen
title201204
  Created No Content: if the transaction is created successfully If the request was successful

Status
subtletrue
colourRed
title404
Not Found: Transaction not found



Status
colourBlue
titlePOST
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
subtletrue
colourGreen
title204
  No Content: if the transaction is renewed successfully

Status
subtletrue
colourRed
title410404
  GoneNot Found: if the transaction doesn't exist 



** start here **

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

...