Page tree

Versions Compared

Key

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

...

Excerpt

Working with a versionable resource (a LDPRv)


A versionable resource is a type of (regular) resource - see RESTful HTTP API - Containers - but it is created by invoking a specific Link header and the GET method has an additional interaction model beyond the GET scenarios when interacting with non-versioned resources.  All of the headers and methods for regular resources are applicable to a versionable resource.

A resource can be declared versionable when it is created originally.  This is achieved by including the following link header to your PUT or POST commands when creating the resource.  When a versionable resource is created, the versions container will be created at the same time.

Code Block
Link: <http://mementoweb.org/ns#OriginalResource>; rel="type"


Request URI: /path/to/resource

Methods: GET, PUT, POST


Status
titleGET
Retrieve the versioned resource from a specific point in time.

For more details about Fedora's datetime negotiation behaviors, see Memento Datetime Negotiation Algorithm.

Request Headers:

ACCEPT-datetime  An RFC-1123 Date. (E.g. "Wed, 30 May 2018 23:02:44 GMT")

Example:

Code Block
curl -H "Accept: text/turtle" -H "Accept-Datetime: Wed, 29 Aug 2018 15:47:50 GMT" http://localhost:8080/rest/path/to/resource

Response:

Code Block
HTTP/1.1 302 Found
Date: Wed, 29 Aug 2018 22:09:28 GMT
Set-Cookie: JSESSIONID=hrj5jm80kdjdw9attrozpy19;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Tue, 28-Aug-2018 22:09:28 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"
Link: <http://localhost:8080/static/constraints/ContainerConstraints.rdf>; rel="http://www.w3.org/ns/ldp#constrainedBy"
Link: <http://localhost:8080/rest/path/to/resource6>; rel="timegate"
Link: <http://localhost:8080/rest/path/to/resource>; rel="original"
Link: <http://localhost:8080/rest/path/to/resource/fcr:versions>; rel="timemap"
Link: <http://mementoweb.org/ns#OriginalResource>; rel="type"
Link: <http://mementoweb.org/ns#TimeGate>; rel="type"
Accept-Patch: application/sparql-update
Accept-Post: text/turtle,text/rdf+n3,text/n3,application/rdf+xml,application/n-triples,application/ld+json
Allow: MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS
Link: <http://localhost:8080/rest/path/to/resource/fcr:acl>; rel="acl"
Preference-Applied: return=representation
Vary: Prefer
Vary: Accept
Vary: Range
Vary: Accept-Encoding
Vary: Accept-Language
Vary: Accept-Datetime
Location: http://localhost:8080/rest/path/to/resource/fcr:versions/20180829154750
Content-Length: 0
Server: Jetty(9.3.1.v20150714)

Status:

Status
subtletrue
colourGreen
title200
302 Found

Status
subtletrue
colourRed
title400
Bad Request: Accept-Datetime header not properly formatted per RFC-1123

Status
subtletrue
colourRed
title406
Unacceptable: No appropriate versioned resource found for the supplied Accept-Datetime value



Examples: 

Code Block
#PUT 
curl -X PUT -H "Link: <http://mementoweb.org/ns#OriginalResource>; rel=\"type\"" http://localhost:8080/rest/path/to/resource


#POST 
curl -X POST -H "Link: <http://mementoweb.org/ns#OriginalResource>; rel=\"type\"" -H "Slug: resource" http://localhost:8080/rest/path/to


...