Using the AttachFS Protocol Bundle

The AttachFS protocol bundle provides a very simple means of accessing attachment and document content as well as creating attachments. The AttachFS protocol bundle is available at the server root “/attachfs”. Access to content via AttachFS requires HTTP authentication to be performed – just as when accessing the server's WebDAV presentation.

Viewing and Downloading Content
$ curl -o file.ods -u awilliam
$ curl -o file.ods -v -u awilliam
The first curl operation requests an attachment from AttachFS; the second curl operation requests the document with objectId#11124685/
Both attachments and documents can be viewed by requesting the id from the “/attachfs/view/” location or downloaded from the “/attachfs/download/” location. The server will determine if the requested content is from an attachment or a document entity by examination of the requested name. For either attachments or documents transformations can be performed using an OSSF chain.

Creating An Attachment

$ curl -u awilliam -T OGo18215321.ods \
    -H 'Content-Type: vnd.oasis.opendocument.spreadsheet'
This curl command will create an attachment with the webdav_uid of "OGo18215321.ods" related to the entity 10100 and with the specified MIME type.
Performing an HTTP PUT operation to the “/attachfs/{name}” location will create a new attachment with the specified name. The attachment id will be returned in the “Etag” attribute of the HTTP 201 response to the PUT request. This attachment will not be related to any entity.

An attachment can also be created by performing the HTTP PUT to the path “/attachfs/{objectId}/{name}” which will create an attachment related to the entity whose objectId is specified in the path. The name of that attachment will be preserved.

No comments:

Post a Comment