A Note on Versionable ResourcesThe following documented API calls are based on the assumption that the resource located at /path/to/some/resource was created as a versionable resource. You can make a resource verisonable by simply adding the following link header to your PUT or POST commands when creating or updating your resource.
Examples:
|
Request URI: /path/to/some/resource/fcr:versions Methods: GET, POST, PATCH
Get a list of the available versions of an objectRequest Headers: ACCEPT application/ld+json, application/link-format, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle Example:
Response:
Status: OK Not Found: This resource is not versioned or this resource is not exist. Response: The requested resource is not available.
|
curl http://localhost:8080/rest/resource/fcr:versions/<timestamp> |
Response:
Status: HTTP/1.1 200 OK Headers: Date: Wed, 30 May 2018 21:11:01 GMT ETag: W/"706475b002bad44f8e5d874b8e7c3b1d35ff9a1c" Last-Modified: Wed, 30 May 2018 21:00:48 GMT Link: <http://www.w3.org/ns/ldp#Resource>;rel="type" Link: <http://www.w3.org/ns/ldp#Container>;rel="type" Link: <http://www.w3.org/ns/ldp#BasicContainer>;rel="type" Memento-Datetime: Wed, 30 May 2018 21:03:54 GMT Link: <http://mementoweb.org/ns#Memento>; rel="type" Link: <http://localhost:8080/static/constraints/ContainerConstraints.rdf>; rel="http://www.w3.org/ns/ldp#constrainedBy" Link: <http://localhost:8080/rest/path/to/resource>; rel="timegate" Link: <http://localhost:8080/rest/path/to/resource>; rel="original" Link: <http://localhost:8080/rest/path/to/resource/fcr:versions>; rel="timemap" Allow: GET,HEAD,OPTIONS,DELETE Preference-Applied: return=representation Vary: Prefer Vary: Accept Vary: Range Vary: Accept-Encoding Vary: Accept-Language Content-Type: text/turtle;charset=utf-8 Content-Length: 1793 Body: @prefix memento: <http://mementoweb.org/ns#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix fedora: <http://fedora.info/definitions/v4/repository#> . <http://localhost:8080/rest/path/to/resource/fcr:versions/20180530210354> rdf:type ldp:RDFSource ; rdf:type ldp:Container ; rdf:type fedora:Resource ; rdf:type ldp:BasicContainer ; rdf:type fedora:Container ; fedora:created "2018-05-30T21:00:48.169Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ; fedora:writable true ; fedora:lastModified "2018-05-30T21:00:48.169Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ; fedora:lastModifiedBy "bypassAdmin" ; fedora:createdBy "bypassAdmin" ; rdf:type ldp:RDFSource ; rdf:type ldp:Container ; fedora:writable true . * Connection #0 to host localhost left intact |
OKStatus:
Not Found: if the version or the resource does not exist
Response: The requested resource is not available.
Request Headers
SLUG (Required) A suggested name for the new child resource, which the repository may ignore.
Example:
curl -X POST -H "Slug: newVersionName" http://localhost:8080/rest/path/to/resource/fcr:versions |
Response:
Status: 201 Created |
Status:
Created: if a new version is created successfully
Not Found: if the resource does not exist
Conflict: if the version label is already in use for another version of this rexource
Response: The requested resource is not available.
Example:
curl -X PATCH http://localhost:8080/rest/path/to/resource/fcr:versions/existingVersionName |
Response:
Status: 204 No Content |
Status:
No Content: if the version is reverted successfully
Not Found: if the version does not exist
Response: The requested resource is not available.
Request URI: /path/to/some/resource/fcr:versions/versionName
Methods: DELETE
Example:
curl -X DELETE http://localhost:8080/rest/path/to/resource/fcr:versions/versionName |
Response:
Status: 204 No Content |
Trying to delete the current version of a resource will result in an error. To revert to an old version of a resource, first revert to the old version using the PATCH method, and then delete the newer version. |
Status:
No Content: if the version is reverted successfully
Bad Request: if trying to delete the most recent version
Response: Cannot remove current version
Not Found: if the version does not exist
Response: The requested resource is not available.