Table of Contents |
---|
Introduction
The Fedora REST API exposes a subset of the Fedora Access and Management APIs as a RESTful (Representational State Transfer) Web Service. For release 3.2, the Fedora REST API has been upgraded to Beta status. With this change the REST API is no longer optional, it is enabled by default as are all of the other Fedora APIs. The primary reasons behind Beta status are the need for more robust testing, as well as the understanding that in a future release the REST API will likely subsume API-A-Lite and API-M-Lite, thus changing the API somewhat.
For examples of how to use the REST API programmatically, please refer to the TestRESTAPI test class (http://fedora-commons.svn.sourceforge.net/viewvc/*checkout*/fedora-commons/fedora/tags/release-3.0/src/test/junit/fedora/test/api/TestRESTAPI.java).
Warning | ||
---|---|---|
| ||
Due to an outstanding bug FCREPO-849, if you use Managed Content for DC, RELS-EXT or RELS-INT then please make sure these datastreams are versionable (the default setting for versionable is "true", so if you haven't specified this datastream property then you are safe). Ensure that you don't inadvertently set this property to "false" for these datastreams when using the API methods. |
...
Info | ||
---|---|---|
| ||
If the contents of your request are invalid, and Fedora produces a validation error (eg invalid FOXML on ingest) the HTTP status code is 400. Previous versions of Fedora reported 500 - Server Failure for validation errors. |
API-A Methods
describeRepository
Panel | ||||
---|---|---|---|---|
| ||||
Not implemented |
...
Panel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
URL Syntax
HTTP Method GET HTTP Response 200 Parameters
Examples /objects?terms=demo&pid=true&subject=true&label=true&resultFormat=xml /objects?query=title%7Erome%20creator%7Estaples&pid=true&title=true&creator=true /objects?query=pid%7E*1&maxResults=50&format=true&pid=true&title=true |
...
Panel | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
URL Syntaxunmigrated-wiki-markup /objects/\{pid\}/datastreams/\{dsID\}/content ? \ [asOfDateTime\] \ [download\] HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:29/datastreams/DC/content /objects/demo:29/datastreams/DC/content?asOfDateTime=2008-01-01 |
...
Panel | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||
URL Syntax
HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:29/methods/demo:27/resizeImage?width=100 /objects/demo:SmileyEarring/methods/demo:DualResolution/fullSize |
...
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
URL Syntax
HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:29/versions /objects/demo:29/versions?format=xml |
...
Panel | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
URL Syntaxunmigrated-wiki-markup /objects/\{pid\} ? \ [format\] \[[asOfDateTime\] HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:29 /objects/demo:29?format=xml /objects/demo:29?asOfDateTime=2008-01-01 |
...
Panel | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
URL Syntax
HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:35/datastreams /objects/demo:35/datastreams?format=xml&asOfDateTime=2008-01-01T05:15:00Z |
...
Panel | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
URL Syntax unmigrated-wiki-markup
HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:29/methods /objects/demo:29/methods?format=xml&asOfDateTime=2008-01-01T05:15:00Z /objects/demo:29/methods/demo:27 /objects/demo:29/methods/demo:27?format=xml&asOfDateTime=2008-01-01T05:15:00Z |
...
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
URL Syntax
HTTP Method GET HTTP Response 200 Parameters
Examples /objects?terms=*&format=xml&pid=true&subject=true&label=true&sessionToken=xyz\\\\ |
API-M Methods
addDatastream
Panel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
URL Syntax
HTTP Method POST HTTP Response 201 Parameters
Examples POST: /objects/demo:29/datastreams/NEWDS?controlGroup=X&dsLabel=New (with Multipart file) POST: /objects/demo:29/datastreams/NEWDS?controlGroup=M&dsLocation=http://example:80/newds&dsLabel=New |
addRelationship
Panel | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||
URL Syntaxunmigrated-wiki-markup /objects/\{pid\}/relationships/new ? \ [subject\] \ [predicate\] \ [object\] \ [isLiteral\] \ [datatype\] HTTP Method POST HTTP Response 200 Parameters
Examples POST /objects/demo:29/relationships/new?subject=info%3afedora%2fdemo%3a29%2fDC&predicate=http%3a%2f%2fwww.example.org%2frels%2fname&object=dublin%20core&isLiteral=true |
...
Panel | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
URL Syntaxunmigrated-wiki-markup /objects/\{pid\}/export ? \ [format\] \ [context\] \ [encoding\] HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:29/export /objects/demo:29/export?context=migrate |
...
Panel | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||
URL Syntax
HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:29/datastreams/DC /objects/demo:29/datastreams/DC?format=xml /objects/demo:29/datastreams/DC?format=xml&validateChecksum=true |
...
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
URL Syntaxunmigrated-wiki-markup /objects/\{pid\}/datastreams/\{dsid\}/versions history ? \ [format\] HTTP Method GET HTTP Response 200 Parameters
Examples GET: /objects/changeme:1/datastreams/DC/versionshistory GET: /objects/changeme:1/datastreams/DC/versionshistory?format=xml |
getDatastreams
Panel | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||
URL Syntax
HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:35/datastreams?profiles=true /objects/demo:35/datastreams?formatprofiles=xmltrue&asOfDateTime=20082012-0108-01T0503T10:1502:00Z00.169Z |
getNextPID
Panel | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
URL Syntax
HTTP Method POST HTTP Response 200 Parameters
Examples POST: /objects/nextPID POST: /objects/nextPID?numPIDs=5&namespace=test&format=xml |
...
Panel | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||
URL Syntax
HTTP Method GET HTTP Response 200 Parameters
Examples /objects/demo:29/relationships /objects/demo:29/relationships?subject=info%3afedora%2fdemo%3a29%2fDC |
...
Panel | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||
URL Syntaxunmigrated-wiki-markup /objects/ \ [\{pid\}\| new\] ? \ [label\] \ [format\] \ [encoding\] \ [namespace\] \ [ownerId\] \ [logMessage\] \ [ignoreMime\] HTTP Method POST HTTP Response 201 Request Content text/xml Parameters
Notes Executing this request with no request content will result in the creation of a new, empty object (with either the specified PID or a system-assigned PID). The new object will contain only a minimal DC datastream specifying the dc:identifier of the object. Examples POST: /objects/new POST: /objects POST: /objects/new?namespace=demo POST: /objects/test:100?label=Test |
...
Panel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
URL Syntax
HTTP Method PUT HTTP Response 200 Parameters
Examples PUT: /objects/demo:35/datastreams/HIGH (with Multipart file) PUT: /objects/demo:35/datastreams/HIGH?dsLocation=http://example:80/highDS?logMessage=Update |
modifyObject
Panel | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||
URL Syntaxunmigrated-wiki-markup /objects/\{pid\} ? \ [label\] \ [ownerId\] \ [state\] \ [logMessage\] \ [\lastModifiedDate\] HTTP Method PUT HTTP Response 200 Parameters
Examples PUT: /objects/demo:29?label=Updated PUT: /objects/demo:29?state=D?logMessage=Deleted |
...
Panel | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||
URL Syntaxunmigrated-wiki-markupSyntax /objects/\{pid\}/datastreams/\{dsID\} ? \ [startDT\] \ [endDT\] \ [logMessage\] HTTP Method DELETE HTTP Response 200 with a string array of the date-time stamps of the versions purged Parameters
Examples DELETE: /objects/demo:35/datastreams/HIGH |
...
Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
URL Syntaxunmigrated-wiki-markup /objects/\{pid\} ? \ [logMessage\] HTTP Method DELETE HTTP Response 204 Parameters
Examples DELETE: /objects/demo:29 |
...
Panel | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||
URL Syntaxunmigrated-wiki-markup /objects/\{pid\}/relationships ? \ [subject\] \ [predicate\] \ [object\] \ [isLiteral\] \ [datatype\] HTTP Method DELETE HTTP Response 200 Return body Text indicating if the relationship was successfully purged: Parameters
Examples DELETE /objects/demo:29/relationships?subject=info%3afedora%2fdemo%3a29%2fDC&predicate=http%3a%2f%2fwww.example.org%2frels%2fname&object=dublin%20core&isLiteral=true |
...
Panel | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
URL Syntax
HTTP Method PUT HTTP Response 200 Parameters
Examples PUT: /objects/demo:35/datastreams/HIGH?dsState=D |
...
Panel | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||
URL Syntaxunmigrated-wiki-markup /objects/\{pid\}/datastreams/\{dsID\} ? \ [versionable\] HTTP Method PUT HTTP Response 200 Parameters
Examples PUT: /objects/demo:35/datastreams/HIGH?versionable=false Validate
URL Syntaxunmigrated-wiki-markup /objects/\{pid\}/validate ? \ [asOfDateTime\] HTTP Method GET HTTP Response 200 (OK) if the validation could be carried out (even if the object is not valid) 404 If some object or datastream could not be carried out 401 If the user credentials was insufficient 400 If the parameters are misformed 409 If one of the relevant objects were locked 500 If something else failed on the server Return Body XML, adhering to this schema
Parameters
Examples GET /objects/validate/demo:29?asOfDateTime=2008-01-01
GET /objects/validate/demo:fail
|
...
Panel |
---|