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
...
Retrieve all triples for the resource Status title GET
Query Parameters:
Status | ||||
---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Request Headers:
Status | ||||
---|---|---|---|---|
|
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 | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
...
Create a new node at the given path Status colour Blue title POST
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 | ||||||
---|---|---|---|---|---|---|
|
...
Create a new node as a child of the given node Status colour Blue title POST
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 | ||||||
---|---|---|---|---|---|---|
|
...
Create a new (named) node as a child of the given node Status colour Blue title POST
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 | ||||
---|---|---|---|---|
|
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 | ||||||
---|---|---|---|---|---|---|
|
...
Create a new node and populate some properties Status colour Blue title POST
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 subtle true title checksum
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 | ||||||
---|---|---|---|---|---|---|
|
...
Create a new node and execute a SPARQL-Update query Status colour Blue title POST
In addition to creating a new node, execute a SPARQL-Update query against the newly created node.
Query Parameters:
Status subtle true title checksum
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 | ||||||
---|---|---|---|---|---|---|
|
...
Create a new resource with binary content Status colour Blue title POST
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 subtle true title checksum
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 | ||||||
---|---|---|---|---|---|---|
|
...
Modify the triples associated with the resource Status colour Yellow title PUT
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 | ||||||
---|---|---|---|---|---|---|
|
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
with SPARQL-Update Status colour Green title PATCH
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Delete a resource Status colour Red title DELETE
Example:
Code Block |
---|
curl -X DELETE "http://localhost:8080/rest/node/to/delete" |
Response:
Code Block |
---|
Status: 204 No Content |
Status:
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Move a resource (and its subtree) to a new location Status subtle true colour Red title MOVE
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Copy a resource (and its subtree) to a new location Status subtle true colour Blue title COPY
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
Binary Content
Request URI: /path/to/some/resource/fcr:content
Methods: GET, PUT, POST
...
Retrieve binary content Status title GET
Request Headers:
Status subtle true title Range
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 | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Upload new binary content Status colour Blue title POST
Request Headers:
(See above) Status subtle true title SLug
Query Parameters:
Status subtle true title checksum
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 | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Replace existing binary content Status colour Yellow title PUT
Request Headers:
(See above) Status subtle true title SLug
Query Parameters:
Status subtle true title checksum
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 | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
Status | ||||||||
---|---|---|---|---|---|---|---|---|
|
Batch Operations
Request URI: /path/to/some/resource/fcr:datastreams
Methods: GET, POST, DELETE
Retrieve multiple binary resources in a single request Status title GET
Info |
---|
An HTTP method returning multipart/form-data is non-standard and a little unusual, but it seems to work well enough. |
Query Parameters:
Identifier for the children with binary content to retrieve (Optional; if omitted, return all binary content children) Status subtle true title DSID
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 | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
...
Create (or replace?) multiple binary resources in a single request Status colour Blue title POST
Delete multiple datastreams in a single request Status colour Red title DELETE
Export / Import
Request URI: /path/to/some/resource
Methods: GET, POST
fcr:export Retrieve serialized form of a resource and its subtree. Status title GET
Request Headers:
Export formats. Depends on wiring. Available in node triples. Will always include jcr/xml (the default) Status subtle true title Format
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 | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
...
fcr:import Import a serialized resource Status colour Blue title POST
Request Headers:
Export formats. Depends on wiring. Available in node triples. Will always include jcr/xml (the default) Status subtle true title Format
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 | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Versioning
Request URI: /path/to/some/resource/fcr:versions
Methods: GET, POST
Warning |
---|
Versioning is not fully implemented in Fedora 4 alpha |
Get a list of the available versions of an object Status title GET
Get a previous version of an object Status title GET
Tag a new version of the object with a labeled version Status colour Blue title POST
Services
Backup and Restore
Request URI: /
Methods: GET, POST
fcr:backup Initiate a (consistent) backup of the repository. Status colour Blue title POST
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 | ||||||
---|---|---|---|---|---|---|
|
...
fcr:restore Restore a backup file into the repository Status colour Blue title POST
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Identifiers
Request URI: /path/to/some/resource/fcr:identifier
Methods: GET, POST
Mint 1 or more new identifiers Status colour Blue title POST
Request Headers:
Status | ||||
---|---|---|---|---|
|
Query Parameters:
Number of identifiers to create (Optional; defaults to 1) Status subtle true title numPIDS
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Transactions
Request URI: /fcr:tx; /path/to/transaction/fcr:tx
Methods: POST
Get the current status of a transaction (TODO?) Status title GET
Create a new transaction Status colour Blue title POST
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 | ||||||
---|---|---|---|---|---|---|
|
...
Save and commit an open transaction. Status colour Blue title POST
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Rollback and close an open transaction Status colour Blue title POST
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Fixity
Request URI: /path/to/some/resource/fcr:fixity
Methods: GET
Get the fixity report for an object Status title GET
Request Headers:
Status | ||||
---|---|---|---|---|
|
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 | ||||||
---|---|---|---|---|---|---|
|
Status | ||||||
---|---|---|---|---|---|---|
|
Workspaces
Request URI: /fcr:workspaces/(workspace name)
Methods: POST
Create a new workspace Status colour Blue title POST
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Content Modeling
Request URI: /fcr:nodetypes
Methods: GET, POST
Node types
get a list of registered types (as RDFS triples) Status title GET
Request Headers:
Status | ||||
---|---|---|---|---|
|
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 | ||||||
---|---|---|---|---|---|---|
|
...
Update the list of node types Status colour Blue title 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. |
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Namespaces
Request URI: /fcr:namespaces
Methods: GET, POST
get a list of registered namespaces and default prefixes Status title GET
Request Headers:
Status | ||||
---|---|---|---|---|
|
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 | ||||||
---|---|---|---|---|---|---|
|
...
add or modify namespaces Status colour Blue title POST
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 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Sitemaps
Request URI: /sitemap
Methods: GET, POST
get an XML Sitemap of content in the repository Status title GET
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 | ||||||
---|---|---|---|---|---|---|
|
Search
Full text
Request URI: /fcr:search
Methods: GET
HTML form for submitting SPARQL queries Status title GET
execute a fulltext search over indexed properties in the repository Status title GET
Query Parameters:
Status | ||||||
---|---|---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Request Headers:
Status | ||||
---|---|---|---|---|
|
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 | ||||||
---|---|---|---|---|---|---|
|
SPARQL
Request URI: /fcr:sparql
Methods: GET
HTML form for submitting SPARQL queries Status title GET
execute a query using a subset of SPARQL/rest/{path/to/object}/fcr:identifier Status colour Blue title POST
- POST mints a new identifier at the given path