Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
CSS Stylesheet
h3 { background-color: #eee; padding: 0.6em; }

 

Table of Contents

Overview

 

Introduction

The Fedora 4 REST API is generally a RESTful API. HTTP methods like GET, PUT, POST and DELETE are implemented on most resource paths. The REST API also relies heavily on content negotiation to deliver context-appropriate responses, and a HATEOAS-driven text/html response (providing a decent admin GUI experience on top of the repository).

The Fedora 4 RDF-based responses may be serialized as:

  • application/n3 (or text/rdf+n3 or text/n3)
  • text/turtle
  • application/n-triples
  • text/trig
  • application/rdf+xml
  • application/rdf+json
  • application/n-quads

The text/html response also includes embedded RDFa markup.

Objects

 Retrieve or manipulate a node in the Fedora 4 repository. 

/rest/{path}
- GET describe object
- POST create a new node of QueryParam "mixin" at {path}
- POST (with an application/sparql-update payload) 

- PUT mutate the object at {path}
- DELETE remove the object at {path}

Code Block
GET /rest/
  list the top-level objects in the repository

POST /rest/fcr:properties with an  application/sparql-update request body
 @prefix dc: <http://purl/somewhere/something/1.1>
 INSERT { <info:fedora:/objects/islandora:xyzasdf> <dc:title> "My title" } WHERE {}
GET /rest/objects/sufia:123456789
  list the properties of this node
 
GET /rest/some-other-object-living-at-jcr-root
  there's nothing special about /objects, it's just another part of the path to an object. List the object properties
 
POST /rest/objects/islandora:xyzasdf with an application/sparql-update request body
 @prefix dc: <http://purl/somewhere/something/1.1>
 INSERT { <info:fedora:/objects/islandora:xyzasdf> <dc:title> "My title" } WHERE {}
 create a new object at /objects/islandora:xyzasdf and run the SPARQL-Update query against the resulting triples
 
POST /rest/objects/islandora:xyzasdf with a turtle/n3/n-triples/etc request body
 <info:fedora:/objects/islandora:xyzasdf> <http://purl/somewhere/something/1.1/title> "My title"
 create a new object at /objects/islandora:xyzasdf with the provided triples
 
POST /rest/objects/islandora:xyzasdf?mixin=fedora:object
  create a new fedora object at /objects/islandora:xyzasdf
 
POST /rest/objects/islandora:xyzasdf/an/arbitrary/hierarchy/to/an/islandora:datastream?mixin=fedora:datastream
  create a new datastream at /objects/islandora:xyzasdf/an/arbitrary/hierarchy/to/an/islandora:datastream in the JCR tree. (This will create all the intermediate nodes)
 
POST /rest/objects/islandora:xyzasdf (where /rest/objects/islandora:xyzasdf already exists) with an optional application/sparql-update or turtle/n3/n-triples/etc body
 @prefix dc: <http://purl/somewhere/something/1.1>
 INSERT { <> <dc:title> "My title" } WHERE {}
 add a child object (with a repository-minted name, creating /objects/islandora:xyzasdf/some-uuid-pattern) to islandora:xyzasdf and run the SPARQL-Query against the resulting object
 
POST /rest/objects/islandora:xyzasdf (where /rest/objects/islandora:xyzasdf already exists)
 -> Slug: 123 
 add a child object with the name 123 (creating /objects/islandora:xyzasdf/123) and run the SPARQL-Query against the resulting object


PUT /rest/objects/sufia:123456789 with an RDF request body
  @prefix dc: <http://purl/somewhere/something/1.1>
  <info:fedora/rest/objects/sufia:123456789> dc:title "xyz"
  
  replace all triples for sufia:123456789 with the triples in the request body (note that some triples are fcrepo-managed (e.g. the fedora-internal namespace) and cannot be modified in this way
 
PATCH /rest/objects/sufia:123456789 with an application/sparql-update request body
  @prefix dc: <http://purl/somewhere/something/1.1>
  INSERT { <info:fedora:/objects/islandora:xyzasdf> <dc:title> "My title" } WHERE {}
 
  "patch" the properties of the sufia:123456789 object by executing the given query
 
DELETE /rest/objects/sufia:123456789
  Delete the node at /objects/sufia:123456789
 
COPY /rest/objects/sufia:123456789 with headers:
   Destination: http://path/to/repository/rest/objects/sufia:987654321
 
   Copy the object (and subtree) at /objects/sufia:123456789 to the provided Destination path
 
MOVE /rest/objects/sufia:123456789 with headers:
   Destination: http://path/to/repository/rest/objects/sufia:987654321

   Move the object (and subtree) at /objects/sufia:123456789 to the provided Destination path

Binary Content

/rest/{path}/ fcr:content

- GET the bytes from {path}/ jcr:content/jcr:data
- POST create a new  nt:file  at {path} with a binary value of the request entity
- PUT mutate the binary value of the  nt:file  at {path}
- DELETE remove the  jcr:content  child from the node at {path}

 

Code Block
GET /rest/objects/sufia:123456789/DS1/fcr:content
  get the binary content of DS1
 
POST /rest/objects/sufia:123456789/THUMBNAIL/fcr:content (with a request body)
  add the binary content from the request body to THUMBNAIL
 
PUT /rest/objects/sufia:123456789/THUMBNAIL/fcr:content (with a request body)
  update the binary content in the THUMBNAIL
 
DELETE /rest/objects/sufia:123456789/THUMBNAIL/fcr:content
  remove the binary content from THUMBNAIL (but leave the object /objects/sufia:123456789/THUMBNAIL there)

 

/rest/{path}/fcr:new/fcr:content
- POST create a new  nt:file  under {path} with a binary value of the request entity

Code Block
POST /rest/objects/sufia:123456789/fcr:new/fcr:content
  create a new child datastream (with an automatically generated unique identifier) with the content provided by the request body

Datastream Batch Operations

/rest/{path}/fcr:datastreams  is only for batch DS operations
- GET
- POST
- DELETE

Code Block
GET /rest/objects/sufia:123456789/fcr:datastreams?dsid=DC&dsid=RELS-EXT&dsid=CONTENT_METADATA
  receive a multipart/mixed response of the 3 named datastreams under /objects/sufia:123456789
 
POST /rest/objects/sufia:123456789/fcr:datastreams (with a multipart body)
  create any number of datastreams under /objects/sufia:123456789
 
DELETE /rest/objects/sufia:123456789/fcr:datastreams?dsid=THUMBNAIL&dsid=CONTENT
  delete the two named datastreams under /objects/sufia:123456789

Fixity

/rest/{path}/fcr:fixity
- GET get the fixity report for the nt:file at {path}

Code Block
GET /rest/objects/sufia:123456789/THUMBNAIL/fcr:fixity
  retrieve the fixity report for the /objects/sufia:123456789/THUMBNAIL node

Versioning

Warning

Versioning is not fully implemented in the Fedora 4 alpha

 

/rest/{path}/fcr:versions
- GET the version history of the nt:file or the nt:folder (as appropriate) at {path}

Code Block
GET /rest/objects/sufia:123456789/fcr:versions
  get the version history of /objects/sufia:123456789 fedora object (not sure what the response looks like, though)
 
GET /rest/objects/sufia:123456789/THUMBNAIL/fcr:versions
  get the version history of the THUMBNAIL datastream
 
POST /rest/objects/sufia:123456789/THUMBNAIL/fcr:versions/XYZ
  tag the current verison of /objects/sufia:123456789/THUMBNAIL with the version label XYZ
GET /rest/objects/sufia:123456789/THUMBNAIL/fcr:content?version=XYZ
  get the jcr:content@jcr:data of  /objects/sufia:123456789/THUMBNAIL with version id 'XYZ'
 
GET /rest/objects/sufia:123456789/fcr:describe?version=XYZ
  get the profile/description of /objects/sufia:123456789 with version id 'XYZ'

Export

/rest/{path}/fcr:export?format={format}
 
- GET an export of the (tree?) under the \{path\}

/rest/{path}/fcr:import?format={format}
- POST an export and it will be deserialized at {path}

Code Block
GET /rest/objects/sufia:123456789/fcr:export
  retrieve a JCR/XML export of the content under /objects/sufia:123456789
 
POST /rest/objects/fcr:import 
  with the request body retrieved as above add sufia:123456789 to the tree at /objects, with all its properties, child nodes, etc
 
POST /rest/fcr:import
  and this works too

Transactions

/rest/fcr:tx
 
- POST create a new transaction session

/rest/{txid}/fcr:tx/
 - GET the status of a transaction

/rest/{txid}/fcr:tx/fcr:commit
 - POST commit the transaction 

/rest/ {txid}/ fcr:tx/fcr:rollback
 - POST abort the transaction 

Code Block
POST /rest/fcr:tx
  the Location header sends you to the repository scoped by the transaction you requested (e.g. Location: /rest/tx:123456)
 
POST /rest/tx:123456/fcr:new
  you can use that transaction ID at the beginning of (most) requests to execute that action within the context of the transaction
 
POST /rest/tx:123456/fcr:tx/fcr:commit
  and then save the 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.
 
POST /rest/tx:123456/fcr:tx/fcr:rollback
  roll it back and forget it ever happened

Workspaces

Warning

The Fedora 4 workspace implementation is in heavy flux.

 

/rest/fcr:workspaces
 
 - GET /rest/fcr:workspaces/{workspace path}
  - POST /rest/fcr:workspaces/{workspace path}

 

Code Block
POST /rest/fcr:workspaces/abc
  create the workspace "abc" 
 
GET /rest/workspace:abc/{path/to/object}
  you can use the workspace identifier at the beginning of (most) requests, just like transactions
 

 

Relationships

See this fcrepo3 discussion: Supporting the Semantic Web and Linked Data

ModeShape REST API: https://docs.jboss.org/author/display/MODE/REST+Service+3.x#RESTService3.x-5.Updateanodeoraproperty

Content Modeling

/rest/fcr:nodetypes

  - GET

  - POST

Warning

The request body format for updating nodetypes is in flux. For now, and in the immediate future, it uses JCR's CND syntax, but we'd prefer a provider-independent format.

Code Block
GET /rest/fcr:nodetypes
  get the RDFS serialization of the fcrepo4 content model
 
POST /rest/fcr:nodetypes (with Content-Type: text/cnd)
 
  [fedora:custom-node-type] > [fedora:resource]
    - fedora:thumbnail (string)
 
  update the fcrepo4 content model using JCR CND declarations
  

 

/rest/ fcr:namespaces
- GET list the registered namespaces
- POST (with a sparql update payload)

Warning

The underlying storage layer restricts what changes can be made to namespace mappings, and will throw an error if:

- a currently registered namespace prefix or URI is re-registered

- an in-use namespace prefix is renamed

- ??

Code Block
GET /rest/fcr:namespaces
  get a list of registered namespaces
 
POST /rest/fcr:namespaces (with Content-Type: application/sparql-update)
  INSERT { <info:some-namespace> <http://purl.org/vocab/vann/preferredNamespacePrefix> "some" } WHERE { }

 

External-ish services

/rest/fcr:sitemap
- GET retrieve a sitemap of all the "fedora:object" in the repository (wrapped as a sitemap index, pointing to other sitemaps..) 

/rest/fcr:search
- GET a basic field search (similar to fcrepo 3.x) that exposes the Modeshape index (somehow.)

Changes planned

Asynchronous API support

Versioning

CND node types

Changelog

 

Endpoints

 

Resources

 

Objects

 

Request URI: /path/to/some/resource

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

 

...

 

Status
titleGET
  Retrieve all triples for the resource

Query Parameters:

Status
subtletrue
titlenon-member-properties
 By default, we include triples for all member resources, in addition to triples about the given node. Setting this to true will exclude member resources from the result.

Status
subtletrue
titleoffset
 Pagination control for member resources

Status
subtletrue
titleLIMIT
 Pagination control for member resources

 

Request Headers:

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

 

Example:

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

Response:

Code Block
Status: 200
 
Headers:
ETag: "686897696a7c876b7e"
Content-Type: text/turtle
Content-Length: 123456
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:
<x> <y> <z>

Status:

Status
subtletrue
colourGreen
title200
 

Status
subtletrue
colourYellow
title304

Status
subtletrue
colourRed
title404

 

...

 

Status
colourBlue
titlePOST
 Create a new node at the given path

Create a new node at the given path, and recursively create any missing parent elements.

Example:

Code Block
curl -X POST "http://localhost:8080/rest/some/path/to/a/new/resource"

Response:

Code Block
Status: 201 Created

Status:

Status
subtletrue
colourGreen
title201
 

...

 

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 an automatically-generated identifier.

Example:

Code Block
curl -X POST "http://localhost:8080/rest/this/node/already/exists"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/this/node/already/exists/some/generated/identifier

Status:

Status
subtletrue
colourGreen
title201
 

 

...

 

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

If the given resource path exists, a POST to that path with a Slug header set will create a new node as a child of the given resource using the provided slug to generate an identifier

Request Headers:

Status
subtletrue
titleSlug
  Use the slug header when creating the new resource (see AtomPub ref?)

Example:

Code Block
curl -X POST -H "Slug: new-node-name" "http://localhost:8080/rest/this/node/already/exists"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/this/node/already/exists/new/node/name
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 (link me!)

Status:

Status
subtletrue
colourGreen
title201
 

 

...

 

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)

Query Parameters:

Status
subtletrue
titlechecksum

 

Example:

Code Block
curl -X POST -H "Content-Type: text/turtle" "http://localhost:8080/rest/node/to/create" -d "@body.rdf"
 
Request Body:
<> 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
 

 

...

 

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. 

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:

Code Block
curl -X POST -H "Content-Type: application/sparql-update" "http://localhost:8080/rest/node/to/create" -d "@body.rdf"
 
Request Body:
 
INSERT {   
  <> dc:title "some-resource-title" .
}
WHERE { }
 

Response:

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

 

Status:

Status
subtletrue
colourGreen
title201
 

 

...

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
titlechecksum

 

Example:

Code Block
curl -X POST "http://localhost:8080/rest/binary/resource/to/create" -d "@picture.jpg"

Response:

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

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

Status:

Status
subtletrue
colourGreen
title201
 

 

...

 

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

 

Example:

Code Block
curl -X POST -H "Content-Type: text/turtle" "http://localhost:8080/rest/node/to/update" -d "@new-triples.rdf"
 
Request Body:
 
<> dc:title "some-resource-title" .
 

Response:

Code Block
Status: 204 No Content

 

Status:

Status
subtletrue
colourGreen
title204
 

 

...

 

Status
colourGreen
titlePATCH
 with SPARQL-Update

Example:

Code Block
curl -X PATCH -H "Content-Type: application/sparql-update" "http://localhost:8080/rest/node/to/update" -d "@body.rdf"
 
Request Body:
 
INSERT {   
  <> dc:title "some-resource-title" .
}
WHERE { }
 

Response:

Code Block
Status: 204 No Content

 

Status:

Status
subtletrue
colourGreen
title204
 

 

...

 

Status
colourRed
titleDELETE
Delete a resource

Example:

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

Response:

Code Block
Status: 204 No Content

 

Status:

Status
subtletrue
colourGreen
title204
 

 

...

 

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

Example:

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

Response:

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

 

Status:

Status
subtletrue
colourGreen
title201
 

Status
subtletrue
colourRed
title409
 Source path already exists

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 a resource (and its subtree) to a new location

Example:

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

Response:

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

 

Status:

Status
subtletrue
colourGreen
title201
 

Status
subtletrue
colourRed
title409
 Source path already exists

Status
subtletrue
colourRed
title412
 Destination path already exists

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

Binary Content

Request URI: /path/to/some/resource/fcr:content

Methods: GET, PUT, POST

 

...

 

Status
titleGET
 Retrieve binary content

Request Headers:

Status
subtletrue
titleRange

Example:

Code Block
curl "http://localhost:8080/rest/path/to/some/resource/fcr:content"

Response:

Code Block
Status: 200
 
Headers:
ETag: "686897696a7c876b7e"
Content-Type: image/jpeg
Content-Length: 123456
Cache-Control: 
Last-Modified-At: 2013-01-01T01:23:45Z
Link: http://localhost:8080/rest/path/to/some/resource;rel="meta"
Accept-Ranges: bytes
 
Body:
<binary content>

Status:

Status
subtletrue
colourGreen
title200
 

Status
subtletrue
colourGreen
title206

Status
subtletrue
colourYellow
title304

Status
subtletrue
colourRed
title404

Status
subtletrue
colourRed
title416

 

...

 

Status
colourBlue
titlePOST
 Upload new binary content

Request Headers:

Status
subtletrue
titleSLug
 (See above)

Query Parameters:

Status
subtletrue
titlechecksum

Example:

Code Block
curl -X POST -d "@image.jpg" "http://localhost:8080/rest/path/to/new/resource/fcr:content" 
Body:
<binary content>

Response:

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

Status:

Status
subtletrue
colourGreen
title201
 

Status
subtletrue
colourRed
title409

 

...

 

Status
colourYellow
titlePUT
 Replace existing binary content

Request Headers:

Status
subtletrue
titleSLug
 (See above)

Query Parameters:

Status
subtletrue
titlechecksum

Example:

Code Block
curl -X POST -d "@image.jpg" "http://localhost:8080/rest/path/to/some/existing/resource/fcr:content" 
Body:
<binary content>

Response:

Code Block
Status: 204 No Content

Status:

Status
subtletrue
colourGreen
title201
 You can also PUT to a new location and Fedora will create the appropriate nodes

Status
subtletrue
colourGreen
title204

Status
subtletrue
colourRed
title409

 

Batch Operations

Request URI: /path/to/some/resource/fcr:datastreams

Methods: GET, POST, DELETE

 

Status
titleGET
 Retrieve multiple binary resources in a single request

Info

An HTTP method returning multipart/form-data is non-standard and a little unusual, but it seems to work well enough.

 

Query Parameters:

Status
subtletrue
titleDSID
  Identifier for the children with binary content to retrieve (Optional; if omitted, return all binary content children)

Example:

Code Block
curl "http://localhost:8080/rest/path/to/some/resource/fcr:datastreams?dsid=content&dsid=thumbnail"

Response:

Code Block
Status: 200 OK
 
Headers:
ETag: "686897696a7c876b7e"
Content-Type: multipart/form-data; boundary=AaB03x
Content-Length: 123456
Cache-Control: 
Last-Modified-At: 2013-01-01T01:23:45Z
 
Body:
--AaB03x
Content-Disposition: attachment; filename="content"
Content-Type: image/tiff
<binary content>
--AaB03x
Content-Disposition: attachment; filename="thumbnail"
Content-Type: image/jpeg
<binary content>

Status:

Status
subtletrue
colourGreen
title200
 

Status
subtletrue
colourRed
title404
 If the parent resource doesn't exist, we return a 404. (TODO: What if an explicitly provided dsid doesn't exist? Is this a 404 too?)

 

...

 

Status
colourBlue
titlePOST
Create (or replace?) multiple binary resources in a single request

Status
colourRed
titleDELETE
Delete multiple datastreams in a single request

Export / Import

Request URI: /path/to/some/resource

Methods: GET, POST

Status
titleGET
  fcr:export Retrieve serialized form of a resource and its subtree.

Request Headers:

Status
subtletrue
titleFormat
 Export formats. Depends on wiring. Available in node triples. Will always include jcr/xml (the default)

Example:

Code Block
curl "http://localhost:8080/rest/path/to/some/resource/fcr:export"

Response:

Code Block
Status: 200
 
Headers:
Content-Type: application/xml
Body:
<jcrxml:jcrxml xmlns:jcrxml="" /> 

Status:

Status
subtletrue
colourGreen
title200
 

Status
subtletrue
colourRed
title404

 

...

 

Status
colourBlue
titlePOST
 fcr:import Import a serialized resource 

Request Headers:

Status
subtletrue
titleFormat
 Export formats. Depends on wiring. Available in node triples. Will always include jcr/xml (the default)

Example:

Code Block
curl -X POST -d "@export.xml" "http://localhost:8080/rest/path/to/some/resource/fcr:import?format=jcr/xml"
 
Body:
<jcrxml:jcrxml xmlns:jcrxml="" /> 

Response:

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

Status:

Status
subtletrue
colourGreen
title200
 

Status
subtletrue
colourRed
title404
 

Versioning

Request URI: /path/to/some/resource/fcr:versions

Methods: GET, POST

 

Warning

Versioning is not fully implemented in Fedora 4 alpha

 

Status
titleGET
 Get a list of the available versions of an object

Status
titleGET
 Get a previous version of an object

Status
colourBlue
titlePOST
Tag a new version of the object with a labeled version

Services

Backup and Restore

Request URI: /

Methods: GET, POST

 

Status
colourBlue
titlePOST
 fcr:backup Initiate a (consistent) backup of the repository. 

Info

The backup will be stored in a temporary directory on the server. As yet, there is not a REST API method for retrieving the content of the backup.

 

Example:

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

 

Response:

Code Block
Status: 200

 
Body:
/tmp/fcrepo4-data/path/to/backup/directory

 

Status:

Status
subtletrue
colourGreen
title200
 

 

...

   

Status
colourBlue
titlePOST
 fcr:restore Restore a backup file into the  repository

Info

Does this overwrite existing data? Merge data with the backup?

 

Example:  

Code Block
curl -X POST -d "@backup.xml" "http://localhost:8080/rest/fcr:restore"
 
Body:
<binary content>

 

Response:

Code Block
Status: 204 No Content

 

Status:

Status
subtletrue
colourGreen
title204
 

Identifiers 

Request URI: /path/to/some/resource/fcr:identifier

Methods: GET, POST

 

Status
colourBlue
titlePOST
Mint 1 or more new identifiers

Request Headers:

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

Query Parameters:

Status
subtletrue
titlenumPIDS
Number of identifiers to create (Optional; defaults to 1)

Example (1):

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

Response:

Code Block
Status: 200 OK
 
Headers:
Content-Type: text/turtle
 
Body:
 
<http://localhost:8080/rest/fcr:identifier> <http://fedora.info/definitions/v4/repository#hasMember> <<http://localhost:8080/rest/newly-minted-identifier>

Example (2):

Code Block
curl -X POST "http://localhost:8080/rest/fcr:identifier?numPids=3"

Response:

Code Block
Status: 200 OK
 
Headers:
Content-Type: text/turtle
 
Body:
 
<http://localhost:8080/rest/fcr:identifier> <http://fedora.info/definitions/v4/repository#hasMember> <http://localhost:8080/rest/newly-minted-identifier><http://localhost:8080/rest/fcr:identifier> <http://fedora.info/definitions/v4/repository#hasMember> <http://localhost:8080/rest/another-newly-minted-identifier><http://localhost:8080/rest/fcr:identifier> <http://fedora.info/definitions/v4/repository#hasMember> <http://localhost:8080/rest/yet-another-minted-identifier>


Example (3):

Code Block
curl -X POST "http://localhost:8080/rest/path/to/some/resource/fcr:identifier"

Response:

Code Block
Status: 200 OK
 
Headers:
Content-Type: text/turtle
 
Body:
 
<http://localhost:8080/rest/path/to/some/resource/fcr:identifier> <http://fedora.info/definitions/v4/repository#hasMember> <http://localhost:8080/rest/path/to/some/resource/newly-minted-identifier>
<http://localhost:8080/rest/path/to/some/resource/fcr:identifier> <http://fedora.info/definitions/v4/repository#hasMember> <http://localhost:8080/rest/path/to/some/resource/another-newly-minted-identifier>
<http://localhost:8080/rest/path/to/some/resource/fcr:identifier> <http://fedora.info/definitions/v4/repository#hasMember> <http://localhost:8080/rest/path/to/some/resource/yet-another-minted-identifier>


Status:

Status
subtletrue
colourGreen
title200
 

Transactions

Request URI: /fcr:tx; /path/to/transaction/fcr:tx

Methods: POST

 

Status
titleGET
 Get the current status of a transaction (TODO?)

Status
colourBlue
titlePOST
 Create a new transaction

Info

After retrieving a transaction resource, the client can execute any REST API method prefixed by the transaction location.

 

Example:

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

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/tx:123456789

Usage:

Code Block
curl -X POST "http://localhost:8080/rest/tx:123456789/path/to/object/to/create"
curl -X DELETE "http://localhost:8080/rest/tx:123456789/path/to/resource/to/delete"
curl -X POST "http://localhost:8080/rest/tx:!23456789/fcr:tx/fcr:commit

Status:

Status
subtletrue
colourGreen
title201
 

 

...

 

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 -X POST "http://localhost:8080/rest/tx:123456789/fcr:tx/fcr:commit" 

Response:

Code Block
Status: 204 No Content

Status:

Status
subtletrue
colourGreen
title204
 

 

...

 

 

Status
colourBlue
titlePOST
 Rollback and close an open transaction

Example:

Code Block
curl -X POST "http://localhost:8080/rest/tx:123456789/fcr:tx/fcr:rollback" 

Response:

Code Block
Status: 204 No Content

Status:

Status
subtletrue
colourGreen
title204
 

Fixity

Request URI: /path/to/some/resource/fcr:fixity

Methods: GET

Status
titleGET
 Get the fixity report for an object

Request Headers:

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

 

Example:

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

Response:

Code Block
Status: 200
 
Headers:
Content-Type: text/turtle
 
Body:
<x> <y> <z>

Status:

Status
subtletrue
colourGreen
title200
 

Status
subtletrue
colourRed
title404

Workspaces

Request URI: /fcr:workspaces/(workspace name)

Methods: POST

Status
colourBlue
titlePOST
 Create a new workspace

Example:

Code Block
curl -X POST "http://localhost:8080/rest/fcr:workspaces/abc"  # create a new workspace called "abc"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/workspace:abc

Usage:

After creating a workspace, you can execute other REST API methods by prefixing the workspace identifier to requests 

Code Block
curl -X POST "http://localhost:8080/rest/fcr:workspaces/abc"
curl -X POST "http://localhost:8080/rest/workspace:abc/path/to/some/new/resource


Status:

Status
subtletrue
colourGreen
title201
 

Content Modeling

Request URI: /fcr:nodetypes

Methods: GET, POST

Node types

Status
titleGET
  get a list of registered types (as RDFS triples)

Request Headers:

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

Example:

Code Block
curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Code Block
Status: 200 OK
 
Headers:
Content-Type: text/turtle
Body:
<x> <y> <z> 

Status:

Status
subtletrue
colourGreen
title200
 

 

...

 

Status
colourBlue
titlePOST
Update the list of node types

Warning

The request body format for updating nodetypes is in flux. For now, and in the immediate future, it uses  JCR's CND syntax , but we'd prefer a provider-independent format.

Example:

Code Block
curl -X POST -H "Content-Type: text/cnd" -d "@cnd.txt" "http://localhost:8080/rest/fcr:nodetypes"
 
Body:
 
[fedora:custom-node-type] > [fedora:resource]
    - fedora:thumbnail (string)
 

Response:

Code Block
Status: 204 No Content

Status:

Status
subtletrue
colourGreen
title204
 

Namespaces

Request URI: /fcr:namespaces

Methods: GET, POST

Status
titleGET
get a list of registered namespaces and default prefixes

Request Headers:

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

Example:

Code Block
curl "http://localhost:8080/rest/fcr:namespaces"

Response:

Code Block
Status: 200 OK
 
Headers:
Content-Type: text/turtle
Body:
<x> <y> <z> 

Status:

Status
subtletrue
colourGreen
title200
 

 

...

 

Status
colourBlue
titlePOST
 add or modify namespaces

Example:

Code Block
curl -X POST -H "Content-Type: application/sparql-update" -d "@namespaces.rdf" "http://localhost:8080/rest/fcr:namespaces"
 
Body:
# Register the namespace 'info:some-namespace' with the prefix 'some'
INSERT { 
    <info:some-namespace> <http://purl.org/vocab/vann/preferredNamespacePrefix> "some" 
} WHERE { 
 
}

Response:

Code Block
Status: 204 No Content

Status:

Status
subtletrue
colourGreen
title204
 

Sitemaps

Request URI: /sitemap

Methods: GET, POST

Status
titleGET
get an XML Sitemap of content in the repository

Example:

Code Block
curl "http://localhost:8080/rest/sitemap"

Response:

Code Block
Status: 200 OK
 
Headers:
Content-Type: text/xml
Body:
<sitemap>
 ...
</sitemap>

Status:

Status
subtletrue
colourGreen
title200
 

 

Full text

Request URI: /fcr:search

Methods: GET

Status
titleGET
 HTML form for submitting SPARQL queries

 

Status
titleGET
execute a fulltext search over indexed properties in the repository

Query Parameters:

Status
subtletrue
titleq
 Query term

Status
subtletrue
titleoffset
 Pagination control for member resources

Status
subtletrue
titleLIMIT
 Pagination control for member resources

 

Request Headers:

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

 

Example:

Code Block
curl -H "Accept: text/turtle" "http://localhost:8080/rest/fcr:search"

Response:

Code Block
Status: 200
 
Headers:
 
Body:
<x> <y> <z>

Status:

Status
subtletrue
colourGreen
title200
 

SPARQL

Request URI: /fcr:sparql

Methods: GET

Status
titleGET
HTML form for submitting SPARQL queries

Status
colourBlue
titlePOST
 execute a query using a subset of SPARQL/rest/{path/to/object}/fcr:identifier
- POST mints a new identifier at the given path