Old Release

This documentation covers an old version of Fedora. Looking for another version? See all documentation.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 17 Next »

Request URI: /path/to/some/resource

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

 


 

GET   Retrieve all triples for the resource

Query Parameters:

OFFSET Pagination control for member resources

LIMIT Pagination control for member resources

 

Request Headers:

ACCEPT  text/turtle, text/rdf+n3, text/n3, application/rdf+xml, application/n-triples, text/html

IF-NONE-MATCH IF-MODIFIED-SINCE

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

URIDescription
http://www.w3.org/ns/ldp#PreferMembershiplinks to other resources (including child nodes) and LDP container properties (included in representation by default)
http://www.w3.org/ns/ldp#PreferContainmenttriples describing the child nodes (included in representation by default)
http://fedora.info/definitions/v4/repository#InboundReferenceslinks from other Fedora resources to this node (excluded from representation by default)

 

Example (1):

curl -H "Accept: text/turtle" "http://localhost:8080/rest/"

Response:

Status: 200 OK
 
Headers:
Content-Type: text/turtle
Cache-Control: 
Last-Modified-At: 2013-01-01T01:23:45Z
Link: http://localhost:8080/rest/?offset=0&limit=10;rel="first"
Link: http://www.w3.org/ns/ldp/Resource;rel="type"
Accept-Patch: application/sparql-update
 
Body:

<http://localhost:8080/rest/>
        a       <http://www.w3.org/ns/ldp#Container> , <http://www.w3.org/ns/ldp#Page> ;
        <http://www.w3.org/ns/ldp#membersInlined>
                "true" ;
        <http://www.w3.org/ns/ldp#membershipObject>
                <http://www.w3.org/ns/ldp#MemberSubject> ;
        <http://www.w3.org/ns/ldp#membershipPredicate>
                <http://fedora.info/definitions/v4/repository#hasChild> ;
        <http://www.w3.org/ns/ldp#membershipSubject>
                <http://localhost:8080/rest/> ;
        <http://www.w3.org/ns/ldp#pageOf>
                <http://localhost:8080/rest/> ;
		<http://fedora.info/definitions/v4/rest-api#exportsAs>
                <http://localhost:8080/rest//fcr:export?format=jcr/xml> ;
        <http://fedora.info/definitions/v4/rest-api#hasNamespaces>
                <http://localhost:8080/rest/fcr:namespaces> ;
        <http://fedora.info/definitions/v4/rest-api#hasTransactionProvider>
                <http://localhost:8080/rest/fcr:tx> ;
        <http://fedora.info/definitions/v4/rest-api#hasWorkspaces>
                <http://localhost:8080/rest/fcr:workspaces> ;
        <http://microformats.org/wiki/rel-sitemap>
                <http://localhost:8080/rest/sitemap> ;


Example (2):

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

Response:

Status: 200 OK
 
Headers:
ETag: "d98e86c48a3e31857f5311f51ad7a2e13a7cedee"
Content-Type: text/turtle
Cache-Control: must-revalidate
Last-Modified: Fri, 15 Nov 2013 23:31:07 +0000
Link: http://localhost:8080/rest/path/to/resource/?offset=0&limit=10;rel="first"
Link: http://www.w3.org/ns/ldp/Resource;rel="type"
Accept-Patch: application/sparql-update
 
Body:

<http://localhost:8080/rest/path/to/resource>
		a       <http://fedora.info/definitions/v4/rest-api#resource> , <http://fedora.info/definitions/v4/rest-api#object> , 		
				<http://www.w3.org/ns/ldp#Container> , <http://www.w3.org/ns/ldp#Page> ;
        <http://fedora.info/definitions/v4/repository#uuid>
                "e8baa85c-f05a-49e8-9578-9adef92ac60d"^^<http://www.w3.org/2001/XMLSchema#string> ;
        <http://www.w3.org/ns/ldp#inlinedResource>
                <http://localhost:8080/rest/path/to> ;
        <http://www.w3.org/ns/ldp#membersInlined>
                "true" ;
        <http://www.w3.org/ns/ldp#pageOf>
                <http://localhost:8080/rest/path/to/resource> .
        <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/rest-api#hasVersions>
                <http://localhost:8080/rest/path/to/resource/fcr:versions> ;
        <http://fedora.info/definitions/v4/repository#created>
                "2013-11-15T23:31:07.275Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
        <http://fedora.info/definitions/v4/repository#createdBy>
                "bypassAdmin"^^<http://www.w3.org/2001/XMLSchema#string> ;
        <http://fedora.info/definitions/v4/repository#hasParent>
                <http://localhost:8080/rest/path/to> ;
        <http://fedora.info/definitions/v4/repository#lastModified>
                "2013-11-15T23:31:07.268Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;


Example (3):

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:

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.0lockable> , <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.0lockable> , <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:

200 OK

304 Not Modified

404 Not Found

 


POST  Create a new node at the given path

Create a new child node at the given path.

Query Parameters:

MIXIN (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):

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

Response:

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

Example (2):

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


Status:

201 Created

409 Conflict (resource is locked)


 

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

SLUG  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

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:

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

Example (1):

curl -X POST -H "Slug: new-node-name" "http://localhost:8080/rest/"

Response:

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


Status:

201 Created

409 Conflict (resource is locked)

 


 

POST  Create a new node and populate some properties

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

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

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:

CONTENT-TYPE  text/turtle

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

Query Parameters:

CHECKSUM

 

Example:

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:

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

 

Status:

201 Created

409 Conflict (resource is locked)

 


 

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

CONTENT-TYPE  application/sparql-update

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

Query Parameters:

CHECKSUM

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

 

Example:

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

Response:

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

 

Status:

201 Created

409 Conflict (resource is locked)

 


POST  Create a new resource with binary content

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

Query Parameters:

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

 

Header Parameters:

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

 

Example (1):

curl -X POST --upload-file picture.jpg "http://localhost:8080/rest/binary/resource/to/create"

Response:

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

Example (2):

curl -X POST --data-binary "@picture.jpg" "http://localhost:8080/rest/binary/resource/to/create?checksum=urn:sha1:cb1a576f22e8e3e110611b616e3e2f5ce9bdb941"

Response:

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

Example (3):

curl -X POST --data-binary "@picture.jpg" "http://localhost:8080/rest/binary/resource/to/create?checksum=urn:sha1:checksumdoesntmatch"

Response:

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

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

Status:

201 Created

409 Conflict (checksum mismatch)

409 Conflict (resource is locked)

 


 

PUT  Modify the triples associated with the resource

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

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

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

 

Request Headers:

CONTENT-TYPE  text/turtle, text/rdf+n3, application/n3, text/n3, application/rdf+xml, application/json+rdf, application/n-triples, text/html

IF-MATCH IF-UNMODIFIED-SINCE

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

Query Parameters:

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


 

Example:

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/>
<> dc:title "some-resource-title" .
 

Response:

Status: 204 No Content

 

Status:

204 No Content

409 Conflict (resource is locked)

412 Precondition Failed

 


 

PATCH  with SPARQL-Update

Request Headers:

IF-MATCH IF-UNMODIFIED-SINCE

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

Example (1):

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:

Status: 204 No Content

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

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:

Status: 204 No Content

 

Status:

204 No Content

409 Conflict (resource is locked)

412 Precondition Failed

 


 

DELETE Delete a resource

Request Headers:

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

Example:

curl -X DELETE "http://localhost:8080/rest/node/to/delete"

Response:

Status: 204 No Content

 

Status:

204 No Content

 


 

MOVE  Move a resource (and its subtree) to a new location

Request Headers:

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

Example (1):

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

Response:

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

 

Example (2):

curl -X MOVE -H "Destination: http://duraspace.org/some/path" "http://localhost:8080/rest/path/to/node"

Response:

Status: 502 Bad Gateway

Status:

201 Created

409 Source path doesn't exists

409 Conflict (resource is locked)

412 Destination path already exists

502 Destination URI isn't a valid resource path

 


 

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

Example:

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

Response:

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

 

Status:

201 Created

409 Source path doesn't exists

409 Conflict (resource is locked)

412 Destination path already exists

502 Destination URI isn't a valid resource path

  • No labels