View Source

To enable a wide range of integration approaches, we wish to have a flexible HTTP-based API that allows preservation actions to be discovered and invoked. We attempt to follow the RESTful style of invocation as far as possible, but extend it using a simple RPC API where appropriate. Essentially, we wish to declare Preservation Actions as resources that can be discovered and invoked from HTTP, but that invocation itself is fundamentally an remote procedure call, and does not fit easily into a RESTful model.

For example, migration of another resource. This should create a new resource, but we wish to support complex parameters over GET as well as POST, so it is not strictly RESTful.

RPC workflow:

* GET tool/{color:#993300}name{color}/{color:#993300}action{color}** Returns a resource that describes the action and its parameters.
* GET/POST to tool/{color:#993300}name{color}/{color:#993300}action{color}/rpc?param=val&param=val
** Creates and redirects to a new resource describing the successful execution (e.g. /tool/{color:#993300}name{color}/{color:#993300}action{color}/result/{color:#993300}UNIQUE-ID{color}/report)
** Resource containing a reference to the results (e.g. /tool/{color:#993300}name{color}/{color:#993300}action{color}/result/{color:#993300}UNIQUE-ID{color}/output
* GET /tool/{color:#993300}name{color}/{color:#993300}action{color}/result/{color:#993300}UNIQUE-ID{color}/output
** Returns the new resource, e.g. a migrated file.
* Alternative GET/POST the RPC endpoint with a standard flag redirect=true, i.e. GET /tool/name/action/rpc?redirect=true
** Redirects to the new resource directly: /tool/{color:#993300}name{color}/{color:#993300}action{color}/result/{color:#993300}UNIQUE-ID{color}/output
* ´╗┐Alternative GET/POST of the RPC endpoint that acts asynchronously.
** Redirects to a new Job Status result instead, which can be polled.
** When execution is complete, JobStatus object redirects to or becomes a Report resource.

The above is a sketch. It is not RESTful, in for example the GET action can be used to create new resources, by acting as a direct resource proxy. However, it attempts to conform to the [http://en.wikipedia.org/wiki/Representational_State_Transfer#Constraints|http://en.wikipedia.org/wiki/Representational_State_Transfer#Constraints] constraints as far as is possible. In particular, care should be taken to ensure that proxied results are cacheable.
[http://en.wikipedia.org/wiki/Remote_procedure_call|http://en.wikipedia.org/wiki/Remote_procedure_call]