Versions Compared

Key

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

Table of Contents
Excerpt

 

Request URI: /path/to/some/resource

Methods: GET, POST, PUT, PATCH, HEAD, OPTIONS, DELETE, MOVE, COPY

 

 


Status
titleGET

  Retrieve all triples for

 Retrieve the content of the resource

Query Parameters

Request Headers:

Status
subtletrue
title

offset Pagination control for member resources

Status
subtletrue
titleLIMIT
 Pagination control for member resources

 

Range
 Byte range of content to retrieve, of the form: "Range: bytes=500-999"

Request Headers:

Status
subtletrue
titleAccept

  text/turtle, text

  RDF sources support content negotiation with these formats: application/ld+json, application/n-triples, application/rdf+

n3

xml,

 text

application/

n3

x-turtle,

 application

application/

rdf

xhtml+xml,

 application

application/

n-triples

xml,

 text

text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Status
subtletrue
titleIf-None-Match
Status
subtletrue
titleIf-Modified-Since

Status
subtletrue
titlePrefer
  return=minimal

return=representation
return=representation; include=" URIs "
return=representation; omit=" URIs "

where minimal indicates that only triples directly related to a resource should be returned, and representation indicates that links to other resources and their properties should also be included. URIs is a space-separate list of LDP defined preferences, and also:

URIDescription
http://

...

fedora.info/definitions/v4/repository#EmbedResources Embed "child" resources in the returned representation
http://

...

fedora.info/definitions/v4/repository#InboundReferencesInclude assertions from other Fedora resources to this node (excluded from representation by default)
http://fedora.info/definitions/v4/

...

repository#ServerManagedEmbed server managed properties in the representation (enabled by default)

 

Example (1): Turtle

Code Block
curl -H "Accept: text/turtle" "http://localhost:8080/rest/path/to/resource"

Response:

Code Block
Status: 200 OK
 
Headers:
ETag: "0ed38fe211c2663ace5322e970e7b7d606196e00"
Last-Modified: Mon, 19 May 2014 19:44:59 GMT
Preference-Applied: return=representation; include="http://www.w3.org/ns/ldp#PreferMembership http://www.w3.org/ns/ldp#PreferContainment"
Vary: Prefer
Accept-Patch: application/sparql-update
Allow: MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS
Accept-Post: text/turtle,text/rdf+n3,application/n3,text/n3,application/rdf+xml,application/n-triples,multipart/form-data,application/sparql-update
Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
Link: <http://www.w3.org/ns/ldp#DirectContainer>;rel="type"
Content-Type: text/turtle
 
Body:

<http://localhost:8080/rest/path/to/resource> <http://fedora.info/definitions/v4/rest-api#hasAccessRoles> <http://localhost:8080/rest/path/to/resource/fcr:accessroles> ;
    <http://fedora.info/definitions/v4/rest-api#exportsAs> <http://localhost:8080/rest/path/to/resource/fcr:export?format=jcr/xml> ;
    <http://fedora.info/definitions/v4/repository#hasParent> <http://localhost:8080/rest/path/to> ;
    a <http://www.w3.org/ns/ldp#Container> , <http://www.w3.org/ns/ldp#DirectContainer> ;
    <http://www.w3.org/ns/ldp#membershipResource> <http://localhost:8080/rest/path/to/resource> ;
    <http://www.w3.org/ns/ldp#hasMemberRelation> <http://fedora.info/definitions/v4/repository#hasChild> ;
    a <http://www.jcp.org/jcr/nt/1.0folder> , <http://www.jcp.org/jcr/nt/1.0hierarchyNode> , <http://www.jcp.org/jcr/nt/1.0base> , <http://www.jcp.org/jcr/mix/1.0created> , <http://fedora.info/definitions/v4/rest-api#resource> , <http://fedora.info/definitions/v4/rest-api#object> , <http://fedora.info/definitions/v4/rest-api#relations> , <http://www.jcp.org/jcr/mix/1.0created> , <http://www.jcp.org/jcr/mix/1.0lastModified>

...

 , <http://www.jcp.org/jcr/mix/1.0referenceable> , <http://purl.org/dc/elements/1.1/describable> , <http://fedora.info/definitions/v4/rest-api#resource> ;
    <http://fedora.info/definitions/v4/repository#primaryType> "nt:folder"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#created> "2014-05-19T19:44:59.647Z"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#lastModified> "2014-05-19T19:44:59.645Z"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#mixinTypes> "fedora:resource"^^<http://www.w3.org/2001/XMLSchema#string> , "fedora:object"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#lastModifiedBy> "bypassAdmin"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#uuid> "2b655d37-e88a-44c5-86c1-3b3935cdea49"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#createdBy> "bypassAdmin"^^<http://www.w3.org/2001/XMLSchema#string> ;
    a <http://www.jcp.org/jcr/nt/1.0folder> , <http://www.jcp.org/jcr/nt/1.0hierarchyNode> , <http://www.jcp.org/jcr/nt/1.0base> , <http://www.jcp.org/jcr/mix/1.0created> , <http://fedora.info/definitions/v4/rest-api#resource> , <http://fedora.info/definitions/v4/rest-api#object> , <http://fedora.info/definitions/v4/rest-api#relations> , <http://www.jcp.org/jcr/mix/1.0created> , <http://www.jcp.org/jcr/mix/1.0lastModified>

...

, <http://www.jcp.org/jcr/mix/1.0referenceable> , <http://purl.org/dc/elements/1.1/describable> , <http://fedora.info/definitions/v4/rest-api#resource> .


Example (2): RDF/XML

Code Block
curl -H "Accept: application/rdf+xml" "http://localhost:8080/rest/path/to/resource"

Response:

Code Block
Status: 200 OK
 
Headers:
ETag: "0ed38fe211c2663ace5322e970e7b7d606196e00"
Last-Modified: Mon, 19 May 2014 19:44:59 GMT
Preference-Applied: return=representation; include="http://www.w3.org/ns/ldp#PreferMembership http://www.w3.org/ns/ldp#PreferContainment"
Vary: Prefer
Accept-Patch: application/sparql-update
Allow: MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS
Accept-Post: text/turtle,text/rdf+n3,application/n3,text/n3,application/rdf+xml,application/n-triples,multipart/form-data,application/sparql-update
Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
Link: <http://www.w3.org/ns/ldp#DirectContainer>;rel="type"
Content-Type: application/rdf+xml 

Body:

...


<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

<rdf:Description rdf:about="http://localhost:8080/rest/path/to/resource">
    <hasAccessRoles xmlns="http://fedora.info/definitions/v4/rest-api#" rdf:resource="http://localhost:8080/rest/path/to/resource/fcr:accessroles"/>
    <exportsAs xmlns="http://fedora.info/definitions/v4/rest-api#" rdf:resource="http://localhost:8080/rest/path/to/resource/fcr:export?format=jcr/xml"/>
    <hasParent xmlns="http://fedora.info/definitions/v4/repository#" rdf:resource="http://localhost:8080/rest/path/to"/>
    <rdf:type rdf:resource="http://www.w3.org/ns/ldp#Container"/>
    <rdf:type rdf:resource="http://www.w3.org/ns/ldp#DirectContainer"/>
    <membershipResource xmlns="http://www.w3.org/ns/ldp#" rdf:resource="http://localhost:8080/rest/path/to/resource"/>
    <hasMemberRelation xmlns="http://www.w3.org/ns/ldp#" rdf:resource="http://fedora.info/definitions/v4/repository#hasChild"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/nt/1.0folder"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/nt/1.0hierarchyNode"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/nt/1.0base"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/mix/1.0created"/>
    <rdf:type rdf:resource="http://fedora.info/definitions/v4/rest-api#resource"/>
    <rdf:type rdf:resource="http://fedora.info/definitions/v4/rest-api#object"/>
    <rdf:type rdf:resource="http://fedora.info/definitions/v4/rest-api#relations"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/mix/1.0created"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/mix/1.0lastModified"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/mix/1.

...

0referenceable"/>
    <rdf:type rdf:resource="http://purl.org/dc/elements/1.1/describable"/>
    <rdf:type rdf:resource="http://fedora.info/definitions/v4/rest-api#resource"/>
    <primaryType xmlns="http://fedora.info/definitions/v4/repository#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">nt:folder</primaryType>
    <created xmlns="http://fedora.info/definitions/v4/repository#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">2014-05-19T19:44:59.647Z</created>
    <lastModified xmlns="http://fedora.info/definitions/v4/repository#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">2014-05-19T19:44:59.645Z</lastModified>
    <mixinTypes xmlns="http://fedora.info/definitions/v4/repository#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">fedora:resource</mixinTypes>
    <mixinTypes xmlns="http://fedora.info/definitions/v4/repository#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">fedora:object</mixinTypes>
    <lastModifiedBy xmlns="http://fedora.info/definitions/v4/repository#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">bypassAdmin</lastModifiedBy>
    <uuid xmlns="http://fedora.info/definitions/v4/repository#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">2b655d37-e88a-44c5-86c1-3b3935cdea49</uuid>
    <createdBy xmlns="http://fedora.info/definitions/v4/repository#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">bypassAdmin</createdBy>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/nt/1.0folder"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/nt/1.0hierarchyNode"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/nt/1.0base"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/mix/1.0created"/>
    <rdf:type rdf:resource="http://fedora.info/definitions/v4/rest-api#resource"/>
    <rdf:type rdf:resource="http://fedora.info/definitions/v4/rest-api#object"/>
    <rdf:type rdf:resource="http://fedora.info/definitions/v4/rest-api#relations"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/mix/1.0created"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/mix/1.0lastModified

...

"/>
    <rdf:type rdf:resource="http://www.jcp.org/jcr/mix/1.0referenceable"/>
    <rdf:type rdf:resource="http://purl.org/dc/elements/1.1/describable"/>
    <rdf:type rdf:resource="http://fedora.info/definitions/v4/rest-api#resource"/>
</rdf:Description>

</rdf:RDF>


Example (3): Prefer headers

Code Block
curl -H "Prefer: return=representation; include=\"http://fedora.info/definitions/v4/repository#InboundReferences\"; omit=\"http://www.w3.org/ns/ldp#PreferMembership http://www.w3.org/ns/ldp#PreferContainment\"" http://localhost:8080/rest/parent

Response:

Code Block
Status: 200 OK
 
Headers:
ETag: "25fb5cb1d24983d57b10cb0b4656de113d5b8257"
Last-Modified: Mon, 19 May 2014 19:24:40 GMT
Preference-Applied: return=representation; include="http://fedora.info/definitions/v4/repository#InboundReferences"
Vary: Prefer
Accept-Patch: application/sparql-update
Allow: MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS
Accept-Post: text/turtle,text/rdf+n3,application/n3,text/n3,application/rdf+xml,application/n-triples,multipart/form-data,application/sparql-update
Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
Link: <http://www.w3.org/ns/ldp#DirectContainer>;rel="type"
Content-Type: text/turtle
 
Body:

<http://localhost:8080/rest/parent> <http://fedora.info/definitions/v4/rest-api#hasAccessRoles> <http://localhost:8080/rest/parent/fcr:accessroles> ;
    <http://fedora.info/definitions/v4/rest-api#exportsAs> <http://localhost:8080/rest/parent/fcr:export?format=jcr/xml> ;
    <http://fedora.info/definitions/v4/repository#hasParent> <http://localhost:8080/rest/> ;
    a <http://www.w3.org/ns/ldp#Container> , <http://www.w3.org/ns/ldp#DirectContainer> ;
    <http://www.w3.org/ns/ldp#membershipResource> <http://localhost:8080/rest/parent> ;
    <http://www.w3.org/ns/ldp#hasMemberRelation> <http://fedora.info/definitions/v4/repository#hasChild> ;
    a <http://www.jcp.org/jcr/nt/1.0folder> , <http://www.jcp.org/jcr/nt/1.0hierarchyNode> , <http://www.jcp.org/jcr/nt/1.0base> , <http://www.jcp.org/jcr/mix/1.0created> , <http://fedora.info/definitions/v4/rest-api#resource> , <http://fedora.info/definitions/v4/rest-api#object> , <http://fedora.info/definitions/v4/rest-api#relations> , <http://www.jcp.org/jcr/mix/1.0created> , <http://www.jcp.org/jcr/mix/1.0lastModified>

...

, <http://www.jcp.org/jcr/mix/1.0referenceable> , <http://purl.org/dc/elements/1.1/describable> , <http://fedora.info/definitions/v4/rest-api#resource> .

<http://localhost:8080/rest/collection> <http://fedora.info/definitions/v4/rels-ext#hasCollectionMember> <http://localhost:8080/rest/parent> .

<http://localhost:8080/rest/parent> <http://fedora.info/definitions/v4/repository#primaryType> "nt:folder"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#created> "2014-05-19T19:21:37.182Z"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#lastModified> "2014-05-19T19:24:40.662Z"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#mixinTypes> "fedora:resource"^^<http://www.w3.org/2001/XMLSchema#string> , "fedora:object"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#lastModifiedBy> "bypassAdmin"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#uuid> "c21706cd-cc1a-4d77-b637-d940e0dc7888"^^<http://www.w3.org/2001/XMLSchema#string> ;
    <http://fedora.info/definitions/v4/repository#createdBy> "bypassAdmin"^^<http://www.w3.org/2001/XMLSchema#string> ;
    a <http://www.jcp.org/jcr/nt/1.0folder> , <http://www.jcp.org/jcr/nt/1.0hierarchyNode> , <http://www.jcp.org/jcr/nt/1.0base> , <http://www.jcp.org/jcr/mix/1.0created> , <http://fedora.info/definitions/v4/rest-api#resource> , <http://fedora.info/definitions/v4/rest-api#object> , <http://fedora.info/definitions/v4/rest-api#relations> , <http://www.jcp.org/jcr/mix/1.0created> , <http://www.jcp.org/jcr/mix/1.0lastModified>

...

, <http://www.jcp.org/jcr/mix/1.

...

0referenceable> , <http://

...

purl.

...

org/

...

dc/elements/1.1/describable> , <http://fedora.info/definitions/v4/rest-api#resource> .

Status:

Status
subtletrue
colourGreen
title200
 OK


Example (4): Non-RDF Source

Code Block
curl "http://localhost:8080/rest/path/to/binary/resource"

Response:

Code Block
Status: 200 OK
 
Headers:
ETag: "0ed38fe211c2663ace5322e970e7b7d606196e00"
Last-Modified: Mon, 19 May 2014 19:44:59 GMT
Vary: Prefer
Link: <http://localhost:8080/rest/path/to/binary/resource/fcr:metadata">;rel="describedby"
Content-Type: image/jpg
 
Body:

{binary content}


Status:

Status
subtletrue
colourYellow
title304
 Not Modified

Status
subtletrue
colour

Red

Green
title200

404

 OK

 Not Found

Status

 

subtle

AnchorCreate Node With Named Path

true
colourYellow
title304
 Not Modified

Status
subtletrue
colourRed
title404
 Not Found

 

Create Node With Named Path


Status
colourBlue
titlePOST

 Create a new node at the given pathCreate a new child node at the given path.

Create new resources within a LDP container

Query Parameters:

Status
subtletrue
title

mixin

checksum
 (Optional

; values: fedora:object, fedora:datastream) Explicitly create an object or datastream, instead of inferring it from the request body 

Request Headers:

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

Example (1):

Code Block
curl -X POST "http://localhost:8080/rest/"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/some/path/to/a/new/resource

Example (2):

Code Block
curl -X POST "http://localhost:8080/rest/?mixin=fedora:datastream" # Create a fedora:datastream

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

 

Status
colourBlue
titlePOST
 Create a new node as a child of the given node

If the given resource path exists, a POST to that path will create a new node as a child of the given resource using a generated identifier.

Request Headers:

Status
subtletrue
titleSlug
  Use the slug header when creating the new resource (see AtomPub slug header). If no slug is provided, the identifier will be automatically generated.

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

Note

The slug you provide does not guarantee the location of the created node. Clients must check the Location header for the path to the created resource. For full control over the generated path, see POST Create a new node at the given path.

Query Parameters:

Status
subtletrue
titlemixin
 (Optional; values: fedora:object, fedora:datastream) Explicitly create an object or datastream, instead of inferring it from the request body 

Example (1):

...

) Provide a SHA-1 checksum which will be checked against the uploaded content to ensure error-free transfer.

Request Headers:

Status
subtletrue
titleContent-Disposition
(Optional) The filename provided in the content disposition header will be stored in a premis:hasOriginalName property.

Status
subtletrue
titleContent-Type
(Optional) MIME type of the uploaded binary or RDF content.

CONTENT-LOCATION (Optional) A URI to a resource to use instead of the request body

Note

If the MIME type corresponds to a supported RDF format or SPARQL-Update, the uploaded content will be parsed as RDF and used to populate the child node properties.  RDF will be interpreted using the current resource as the base URI (e.g. <> will be expanded to the current URI). Namespaces must be declared in full.

For other MIME types, the uploaded content will be used to create a binary resource.

Status
subtletrue
titleSLUG
(Optional) A suggested name for the new child resource, which the repository may ignore.

Note

The slug you provide does not guarantee the location of the created resource. Clients must check the Location header for the path to the created resource.

 

Example (1): Create a new child node

Code Block
curl -X POST "http://localhost:8080/rest/"

Response:

Code Block
Status: 201 Created
 
Headers:
ETag: "3ac31b09de1536a332d9c6ee8453669947721840"
Location: http://localhost:8080/rest/some/path/to/a/new/resource
 
Body:
http://localhost:8080/rest/some/path/to/a/new/resource


Example (2): Create a new child binary resource with empty content

Code Block
curl -i -X POST -H "Content-Type:text/plain" "http://localhost:8080/rest"

Response:

Code Block
Status: 201 Created
ETag: "487f188240d2be3ae32d49958c0eeea18224be0a"
Last-Modified: Thu, 29 May 2014 15:46:13 GMT
Link: <http://localhost:8080/rest/

...

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/new-node-name"

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

 

 

Status
colourBlue
titlePOST
  Create a new node and populate some properties

In addition to creating a new node, add the given properties to the object

Note

An RDF payload can be combined with any of the above forms.

Note

RDF will be interpreted using the current resource as the base URI (e.g. <> will be expanded to the current URI). Namespaces must be declared in full.

Request Headers:

Status
subtletrue
titleContent-Type
  text/turtle

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

Query Parameters:

Status
subtletrue
titlechecksum

 

Example:

Code Block
curl -X POST -H "Content-Type: text/turtle" --data-binary "@body.rdf" "http://localhost:8080/rest/node/to/create"
 
Request Body:
PREFIX dc: <http://purl.org/dc/elements/1.1/>
<> dc:title "some-resource-title"
 

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/node/to/create

 

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

 

 

Status
colourBlue
titlePOST
 Create a new node and execute a SPARQL-Update query

In addition to creating a new node, execute a SPARQL-Update query against the newly created node. 

Request Headers:

Status
subtletrue
titleContent-Type
  application/sparql-update

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

Query Parameters:

Status
subtletrue
titlechecksum

Note

RDF will be interpreted using the current resource as the base URI (e.g. <> will be expanded to the current URI)

 

Example:

...

b8/fc/32/be/b8fc32be-34be-428e-bf7c-81be97e5f2e3/fcr:metadata>; rel="describedby"; anchor="http://localhost:8080/rest/b8/fc/32/be/b8fc32be-34be-428e-bf7c-81be97e5f2e3"
Location: http://localhost:8080/rest/b8/fc/32/be/b8fc32be-34be-428e-bf7c-81be97e5f2e3
Content-Type: text/plain
Transfer-Encoding: chunked
 
Body:
http://localhost:8080/rest/b8/fc/32/be/b8fc32be-34be-428e-bf7c-81be97e5f2e3


Example (3): Create a new container with RDF properties

Code Block
curl -i -X POST -H "Content-Type: text/turtle" --data-binary "@body.rdf" "http://localhost:8080/rest/"
 
Request Body:
PREFIX dc: <http://purl.org/dc/elements/1.1/>
<> dc:title "some-resource-title" 

Response:

Code Block
Status: 201 Created
 
Headers:
ETag: "a66937ca13bc29c63f7b1a55d447a76cd8f1d573"
Location: http://localhost:8080/rest/new/node/uri
 
Body:
http://localhost:8080/rest/new/node/uri


Example (4): Uploaded file with checksum

Code Block
curl -i -X POST --data-binary "@picture.jpg" "http://localhost:8080/rest/parent/container?checksum=urn:sha1:cb1a576f22e8e3e110611b616e3e2f5ce9bdb941"

Response:

Code Block
Status: 201 Created
 
Headers:
ETag: "fe4e2bf389fe05dab6390564e40012d8d36eca19"
Location: http://localhost:8080/rest/parent/object/auto/generated/ds/id
 
Body:
http://localhost:8080/rest/parent/object/auto/generated/ds/id


Example (5): Uploaded file with checksum mismatch

Code Block
curl -X POST --data-binary "@picture.jpg" "http://localhost:8080/rest/parent/object?checksum=urn:sha1:checksumdoesntmatch"

Response:

Code Block
Status: 409 Conflict
 
Body:
Checksum Mismatch of cb1a576f22e8e3e110611b616e3e2f5ce9bdb941 and urn:sha1:checksumdoesntmatch

 


Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title404
Not Found (resource does not exist – use PUT to specify a new resource name)

Status
subtletrue
colourRed
title409
Conflict (checksum mismatch)

 


Status
colourYellow
titlePUT
 
Create a resource with a specified path, or replace the triples associated with a resource with the triples provided in the request body.

Note

Some resource properties are repository managed and cannot be removed or modified. Any attempt to do so may result in a 4xx error.

Note

RDF will be interpreted using the current resource as the base URI (e.g. <> will be expanded to the current URI)

 

Request Headers:

Status
subtletrue
titleContent-Type
  text/turtle, text/rdf+n3, application/n3, text/n3, application/rdf+xml, application/n-triples, text/html, text/plain, application/ld+json, message/external-body

Status
subtletrue
titleIF-Match

Status
subtletrue
titleIf-UNModified-Since

CONTENT-LOCATION (Optional) A URI to a resource to use instead of the request body

Query Parameters:

Status
subtletrue
titlechecksum
 Checksum of the binary content (in the form urn:sha1:<sha1-hash>). If the checksum doesn't match, a 409 Conflict will be returned.

 

Example (1): Updating properties with RDF content

1.1 Perform a GET to the current container's RDF content

Code Block
curl -X GET -H "Accept: text/turtle" "http://localhost:8080/rest/node/to/update" 
 
Body:
@prefix dc: <http://purl.org/dc/elements/1.1/>
...
@prefix ldp: <http://www.w3.org/ns/ldp#>
<http://localhost:8080/rest/node/to/update> a ldp:RDFSource , ldp:Container , <http://www.jcp.org/jcr/nt/1.0folder> , <http://www.jcp.org/jcr/nt/1.0hierarchyNode> , <http://www.jcp.org/jcr/nt/1.0base> , <http://www.jcp.org/jcr/mix/1.0created> , fedora:Container , fedora:Resource , fedora:Resource , <http://www.jcp.org/jcr/mix/1.0created> , <http://www.jcp.org/jcr/mix/1.0lastModified> , <http://www.jcp.org/jcr/mix/1.0referenceable> ;
	fedora:primaryType "nt:folder"^^<http://www.w3.org/2001/XMLSchema#string> ;
	fedora:created "2014-11-20T16:23:31.684Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
	fedora:lastModified "2014-11-20T16:23:31.684Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
	fedora:mixinTypes "fedora:Container"^^<http://www.w3.org/2001/XMLSchema#string> , "fedora:Resource"^^<http://www.w3.org/2001/XMLSchema#string> ;
	...
<http://fedora.info/definitions/v4/repository#jcr/xml> rdfs:label "jcr/xml"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://54.173.23.104:8080/fcrepo4/rest/test1/fcr:export?format=jcr/xml> dc:format <http://fedora.info/definitions/v4/repository#jcr/xml> .

1.2 Add your updates (e.g. <> dc:title "some-resource-title" .) under the full result of the GET response in 1.1

Code Block
curl -X PUT -H "Content-Type: text/turtle" --data-binary "@new-triples.rdf" "http://localhost:8080/rest/node/to/update"
 
Request Body:
 
@prefix dc: <http://purl.org/dc/elements/1.1/>
...
@prefix ldp: <http://www.w3.org/ns/ldp#>
<http://localhost:8080/rest/node/to/update> a ldp:RDFSource , ldp:Container , <http://www.jcp.org/jcr/nt/1.0folder> , <http://www.jcp.org/jcr/nt/1.0hierarchyNode> , <http://www.jcp.org/jcr/nt/1.0base> , <http://www.jcp.org/jcr/mix/1.0created> , fcrepo:Container , fcrepo:Resource , fcrepo:Resource , <http://www.jcp.org/jcr/mix/1.0created> , <http://www.jcp.org/jcr/mix/1.0lastModified> , <http://www.jcp.org/jcr/mix/1.0referenceable> ;
	fcrepo:primaryType "nt:folder"^^<http://www.w3.org/2001/XMLSchema#string> ;
	fcrepo:created "2014-11-20T16:23:31.684Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
	fcrepo:lastModified "2014-11-20T16:23:31.684Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
	fcrepo:mixinTypes "fedora:Container"^^<http://www.w3.org/2001/XMLSchema#string> , "fedora:Resource"^^<http://www.w3.org/2001/XMLSchema#string> ;
	...
<http://fedora.info/definitions/v4/repository#jcr/xml> rdfs:label "jcr/xml"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://54.173.23.104:8080/fcrepo4/rest/test1/fcr:export?format=jcr/xml> dc:format <http://fedora.info/definitions/v4/repository#jcr/xml> .
<> dc:title "some-resource-title" .
 

Response:

Code Block
Status: 204 No Content

 

Example (2): Creating a new resource at a specified path

Code Block
curl -i -X PUT "http://localhost:8080/rest/node/to/create"

Response:

Code Block
Status: 201 Created

Response Headers:
ETag: "ef214795c3b9109389ffa542a6c081976e1e9587"
Last-Modified: Mon, 19 May 2014 20:52:57 GMT
Location: http://localhost:8080/rest/node/to/create
 
Body:
http://localhost:8080/rest/node/to/create

 

Example (3): Creating new binary resource at a specified path

Code Block
curl -X PUT --upload-file image.jpg -H"Content-Type: image/jpeg" "http://localhost:8080/rest/

...

new/image"

Response:

Code Block
Status: 201 Created

Headers:
ETag: "urn:sha1:ea3d29b28522724a82de042a7b7a4e79a1653435"
Last-Modified: Mon, 19 May 2014 20:55:31 GMT
Location: http://localhost:8080/rest/new/image
 
Body:

Response:

...

http://localhost:8080/rest/

...

new/

...

image

 

Note that once a resource is created as an RDF or non-RDF source, it must remain an RDF or non-RDF source. In order to change the type of resource, you must DELETE and then re-create the resource.

Status

 

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

 

Status
colourBlue
titlePOST
  Create a new resource with binary content

Note

If the binary content is RDF or a SPARQL-Update query, see Binary Content for an alternative way to create content

Query Parameters

:

Status
subtletrue

title

colour

checksum Checksum of the binary content (in the form urn:sha1:<sha-hash>). If the checksum doesn't match, an error will be returned.

 

Green
title204
 No Content

Header Parameters:

Status
subtletrue
colourRed
title

Content-DISPOSITION The filename provided in the content disposition header will be stored in a premis:hasOriginalName property.

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

 

412
 Precondition Failed

 

Anchor
external-content
external-content
Example (4): Creating a new binary resource at a specified path redirecting to external content

Example (1):

Code Block
curl -X 

...

PUT -H"Content-

...

Type: message/external-body; access-type=URL; URL=\"http://www.example.com/file\"" "http://localhost:8080/rest/

...

node/to/create"

Response:

Code Block
Status: 201 Created

...


Headers:
ETag: "ef214795c3b9109389ffa542a6c081976e1e9587"
Last-Modified: Mon, 19 May 2014 20:52:57 GMT

...

Link: 

...

<http://localhost:8080/rest/

...

node/to/create/fcr:

...

Example (2):

...

metadata>; rel="describedby"
Location: http://localhost:8080/rest/node/to/create
 
Body:
http://localhost:8080/rest/

...

node/to/create

...

 

 


Anchor
patch
patch

Status
colourGreen
titlePATCH
 
Modify the triples associated with a resource with SPARQL-Update

Request Headers:

Status
subtletrue
titleIF-Match

Status
subtletrue
titleIf-UNModified-Since

CONTENT-LOCATION (Optional) A URI to a resource to use instead of the request body

Example (1

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/binary/resource/to/create/fcr:content

Example (3

):

Code Block
curl -X

...

 PATCH -H "Content-Type: application/sparql-update" --data-binary "

...

@body.

...

rdf" "http://localhost:8080/rest/

...

node/to/

...

update"
 
Request Body:
 
PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT {   
  <> dc:title "some-resource-title" .
}
WHERE { }
 

Response:

Code Block
Status: 204 No Content

Example (2): Updating multiple containers with a single SPARQL Update

Code Block
curl -X PATCH -H "Content-Type: application/sparql-update" --data-binary "@body.rdf" "http://localhost:8080/rest/node/to/update"
 
Request Body:
 
PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT {   
  <> dc:title "some-resource-title" .
  <http://localhost:8080/rest/another/node/to/update> dc:title "some-other-title" .
}
WHERE { } 

Response:

Code Block
Status: 204 No Content

 

Status:

Status
subtletrue
colourGreen
title204
 No Content

Status
subtletrue
colourRed
title412
 Precondition Failed

 


Status
colourRed
titleDELETE
Delete a resource

Example:

Code Block
curl -X DELETE "http://localhost:8080/rest/resource/to/delete"

Response:

Code Block
Status: 204 No Content

 

Delete requests create "tombstone" resources which need to be removed before you can reuse a URI

Response:

Code Block
Status: 409 Conflict
 
Error:
Checksum Mismatch of cb1a576f22e8e3e110611b616e3e2f5ce9bdb941 and urn:sha1:checksumdoesntmatch
Note

By convention, binary content is accessed using the REST endpoint path/to/resource/fcr:content.

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
 Conflict (checksum mismatch)

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

 

 

Status
colourYellow
titlePUT
 Modify the triples associated with the resource

Replace the existing triples for a resource with the triples provided in the request body.

Note

Some resource properties are repository managed and cannot be removed or modified. Any attempt to do so may result in a 4xx error.

Note

RDF will be interpreted using the current resource as the base URI (e.g. <> will be expanded to the current URI)

 

Request Headers:

Status
subtletrue
titleContent-Type
  text/turtle, text/rdf+n3, application/n3, text/n3, application/rdf+xml, application/json+rdf, application/n-triples, text/html

Status
subtletrue
titleIF-Match
Status
subtletrue
titleIf-UNModified-Since

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

Query Parameters:

Status
subtletrue
titlechecksum
 Checksum of the binary content (in the form urn:sha1:<sha-hash>). If the checksum doesn't match, an error will be returned

.

 

Example:

Code Block
curl -X 

...

GET "http://localhost:8080/rest/

...

some/

...

deleted/

...

resource"
Code Block
Status: 410 Gone
Link: <http://

...

Response:

Code Block
Status: 204 No Content

 

Status:

Status
subtletrue
colourGreen
title204
 No Content

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

Status
subtletrue
colourRed
title412
 Precondition Failed

 

 

Status
colourGreen
titlePATCH
 with SPARQL-Update

Request Headers:

Status
subtletrue
titleIF-Match
Status
subtletrue
titleIf-UNModified-Since

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operatio

Example (1):

localhost:8080/rest/some/deleted/resource/fcr:tombstone>; rel="hasTombstone"
 
Body:
Discovered tombstone resource at /some/deleted/resource {jcr:primaryType=fedora:Tombstone, jcr:created=2014-11-20T16:04:21.131Z, jcr:createdBy=bypassAdmin}
Code Block
curl -X 

...

DELETE "http://localhost:8080/rest/some/

...

deleted/

...

resource/

...

fcr:tombstone"
Code Block
Status: 204 No Content

Create a new node and reuse the deleted URL

Code Block
curl -X PUT "http://localhost:8080/rest/some/deleted/resource"
Code Block
Status: 201 Created


Status:

Status
subtletrue
colourGreen
title204
 No Content

Status
subtletrue
colourRed
title404
Not Found

 


Status
subtletrue
colourGreen
titleHEAD
 
Retrieve the resource headers

Example:

Code Block
curl -i -X HEAD "http://localhost:8080/rest/resource/to/head"

Response:

Code Block
Status: 

...

Example (2): Updating multiple objects with a single SPARQL Update

...

200 OK
ETag: "bbdd92e395800153a686773f773bcad80a51f47b"
Last-Modified: Wed, 28 May 2014 18:31:36 GMT
Last-Modified: Thu, 20 Nov 2014 15:44:32 GMT
Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
Link: <http://

...

www.w3.org/

...

Response:

...

ns/ldp#Container>;rel="type"
Link: <http://www.w3.org/ns/ldp#BasicContainer>;rel="type"
Accept-Patch: application/sparql-update
Accept-Post: text/turtle,text/rdf+n3,text/n3,application/rdf+xml,application/n-triples,multipart/form-data,application/sparql-update
Allow: MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS

 

Status:

Status
subtletrue
colourGreen
title

204

200

 No Content

 OK

Status
subtletrue
colourRed
title404

409 Conflict (resource is locked)

 Not Found

 



Status
subtletrue
colour

Red

Yellow
title

412 Precondition Failed

 

 

Status
colourRed
titleDELETE
Delete a resource

Request Headers:

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

OPTIONS
 
Outputs information about the supported HTTP methods, etc.


Example:

Code Block
curl -i -X OPTIONS "http://localhost:8080/rest/node/to/options"

Response:

Code Block
Status: 200 OK
Accept-Patch: application/sparql-update
Allow: MOVE,COPY,DELETE

...

Response:

...

,POST,HEAD,GET,PUT,PATCH,OPTIONS
Accept-Post: text/turtle,text/rdf+n3,application/n3,text/n3,application/rdf+xml,application/n-triples,multipart/form-data,application/sparql-update

 

Status:

Status
subtletrue
colourGreen
title

204

200
 OK

 No Content  Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

 


Status
subtletrue
colourRed
titleMOVE
 Move a resource (and its subtree) to a new location

Request Headers:

Note: A federated resource can be moved within the federation, but not from the federation to the internal repository (or vice versa)

Example (1):

Code Block
curl -X MOVE -H "Destination: http://localhost:8080/rest/new/path/to/

...

resource" "http://localhost:8080/rest/path/to/

...

resource"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/new/path/to/

...

resource

 

Example (2):

Code Block
curl -X MOVE

...

 "http://localhost:8080/rest/path/to/

...

resource"

Response:

Code Block
Status: 502 Bad Gateway

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
 Source path doesn't

exists
Status
subtletrue
colourRed
title409
Conflict (resource is locked)

exist

Status
subtletrue
colourRed
title412
 Destination path already exists

Status
subtletrue
colourRed
title502
 Destination URI isn't a valid resource path

 

 


Status
subtletrue
colourBlue
titleCOPY

 Copy

Copy a resource (and its subtree) to a new location

Example:

Code Block
curl -X COPY -H "Destination: http://localhost:8080/rest/new/path/to/

...

resource" "http://localhost:8080/rest/path/to/

...

resource"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/new/path/to/

...

resource

 

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
 Source path doesn't exists

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

Status
subtletrue
colourRed
title412
 Destination path already exists

Status
subtletrue
colourRed
title502
 Destination URI isn't a valid resource path