Aaron Birkland pointed out a severe, and unrecoverably problem with this proposal. For a versionable datastream, a new version is created for each property or content change. As such, to not make 10 versions with a datastream update, a proper transaction system, or methods that allow you to change all the properties in one invocation is nessesary. For that reason, a modifyDatastream method like in the current API is still required.
In this I will propose an alternative REST api to the one in the Fedora Documentation. It is made to support CRUD (Create, Retrieve, Update, Delete) workflows more natively than the current Fedora APIs. It is based around the idea that every conceivable url should be gettable, and probably puttable. There should not be big methods with lots of parameters, but rather a bunch of small resources with very clear purpose.
For CRUD purposes, foxml is not the format of Fedora. Foxml is a very useful and welldesigned storage format, but it is intricate. There will be no ingest or exportToXML methods in this api, as the user should not have to understand foxml. Rather, the Fedora objects is decomposed into resources, available through through URLs.
Content |
Location |
---|---|
Objects |
/objects/ |
Object presentation |
/objects/{pid} |
Object properties |
/objects/{pid}/properties |
Object relations |
/objects/{pid}/relations |
Object content models |
/objects/{pid}/contentmodels |
Datastreams |
/objects/{pid}/datastreams |
Datastream |
/objects/{pid}/datastreams/{dsID} |
Datastream content |
/objects/{pid}/datastreams/{dsID}/content |
Datastream properties |
/objects/{pid}/datastreams/{dsID}/properties |
Datasteram relations |
/objects/{pid}/datastreams/{dsID}/relations |
Datastream versions |
/objects/{pid}/datastreams/{dsID}/versions |
Object Methods |
/objects/{pid}/methods |
Method invocation |
/objects/{pid}/methods/{sdef}/{methodName}?params |
PUT /objects/{pid}
Return: Nothing or pid of the new object
Creates a new, empty object
POST /objects/
Return: pid of the new object (/objects/demo:newObject2)
Creates a new, empty object
PUT /objects/{pid}/datastreams/{dsID}[/withControlGroup/{cg}]
Creates a new datastream in the object with controlgroup X or {cg} if specified. Datastream is empty.
GET /objects/{pid}
Return: XML that presents the object....
Undetailed
GET /objects/{pid}/properties
Return: list of property names (/object/demo:myPid2/properties/label)
Provides a list of property names that can be queried
GET /objects/{pid}/properties/{property}
Return: The value
Give the value of the specific property, or 404 if property not found
Example: /objects/demo:myPid2/properties/label
GET /objects/{pid}/contentmodels
Return: Get the content models of the object (/objects/demo:contentmodel)
Get a list of the content models of this object
GET /objects/{pid}/relations
Return: Return a list of relation names
GET /objects/{pid}/relations/{rel-name}
Return: List of pids of objects referred by this relation
GET /objects/{pid}/methods
Return: a list of objects
GET/POST /objects/{pid}/methods/{sdef}/{methodName}?params
GET /objects/{pid}/datastreams/{dsID}
GET /objects/{pid}/datastreams/{dsID}/properties
GET /objects/{pid}/datastreams/{dsID}/properties/{prop}
Return: The value
GET /objects/{pid}/datastreams/{dsID}/relations
The RELS-INT block "about" this datastream
The idea is that the old version of the datastream should support the same getter methods as the current version
GET /objects/{pid}/datastreams/{dsID}/versions
GET /objects/{pid}/datastreams/{dsID}/versions/{timestamp}/contents
GET /objects/{pid}/datastreams/{dsID}/versions/{timestamp}/properties
GET /objects/{pid}/datastreams/{dsID}/versions/{timestamp}/properties/{propertyname}
GET /objects/{pid}/datastreams/{dsID}/versions/{timestamp}/relations/
PUT /objects/{pid}/properties/{property}
Contents: The new value
Return nothing, or 404 if property not found. New properties cannot be created.
PUT /objects/{pid}/relations/{rel-name}/to/{objpid}
PUT /objects/{pid}/contentmodels/{cmpid}
Contents: Nothing
Add cmpid to the list of content model for this object
PUT /objects/{pid}/relations/{rel-name}/toLiteral/{value}[/withType/{type}]
POST /objects/{pid}/datastreams/{dsID}/contents
Contents: The new content of the datastream
PUT /objects/{pid}/datastreams/{dsID}/properties/{prop}
Contents: The new value
examples: versionable, state and so on.
Contentlocation is just a property of these datastreams
PUT /objects/{pid}/datastreams/{dsID}/properties/contentLocation
Contents: The URL to the contents of the datastream
PUT /objects/{pid}/datastreams/{dsID}/relations/{rel-name}/to/{objPid}
PUT /objects/{pid}/datastreams/{dsID}/relations/{rel-name}/toLiteral/{value}[/withType/{type}]
DELETE /objects/{pid}
DELETE /objects/{pid}/contentmodels/{cmpid}
Contents: Nothing
Remove cmpid from the list of content models for this object
DELETE /objects/{pid}/relations/{rel-name}/to/{objpid}
DELETE /objects/{pid}/relations/{rel-name}/toLiteral/{value}
DELETE /objects/{pid}/datastreams/{dsID}
Purge the datastream from the object from the repository
DELETE /objects/{pid}/datastreams/{dsID}/relations/{rel-name}/to/{objPid}
DELETE /objects/{pid}/datastreams/{dsID}/relations/{rel-name}/toLiteral/{value}