Overview

This describes how to create, retrieve, update and delete BLOB content in Callimachus. 

BLOB files in Callimachus may include text or HTML pages, images, CSS stylesheets, etc. See Appendix for supported file types. However, bulk RDF instance data is also loaded via files and is thus treated as a BLOB for the purposes of this API, even though Callimachus will load it into an RDF database after ingestion.

To perform CRUD operations on BLOB content, first retrieve the Atom contents feed for the folder you want to operate in. See the section on Browsing Content above for details.

Operations

Create

Content may be created in a folder by issuing an HTTP POST to the folder's URL provided in the app:collection element of the folder's Atom contents feed. The body of the POST consists of the contents of the file you wish to upload. The HTTP header Content-Type: must be set appropriately for the type of file. Take note of the acceptable file types in Appendix. The file name you wish to create must be provided in the HTTP request header Slug:, whose value should be URI safe. See slug syntax.

The app:collection tag lists the MIME types that are acceptable to your Callimachus server.

For example, let's say you wanted to create an image called mylogo.png in the top-level folder. If the image file is located in a file of that name in the present working directory:

POST http://example.com:8080/#app:collection HTTP/1.1
Slug: mylogo.png
Content-Type: image/png
Authorization: Digest username="john", realm="http://example.com:8080/", ...

The equivalent curl command is:

curl --digest --user john --data-binary @mylogo.png -H "Content-Type: image/png" -H "Slug: mylogo.png" \
  "http://example.com:8080/#app:collection"

Normal HTTP response codes are used to indicate success or failure of the request:

HTTP/1.1 201 Created
Location:  http://example.com:8080/mylogo.png
Server:  Callimachus Server/Callimachus 0.15

NB: Callimachus Folders are RDF resources. See the section CRUD Operations on RDF Content for details on how to create folders.

Retrieve

Resources may be retrieved by performing an HTTP GET on the resource's edit media URL. A resource's edit media URL may be discovered by looking for the appropriate entry tag in the containing folder's Atom feed and then finding the link tag with rel="edit-media".

To retrieve the image created above:

GET http://example.com:8080/mylogo.png#rel=edit-media HTTP/1.1
Accept: image/png

The equivalent curl command is:

curl "http://example.com:8080/mylogo.png#rel=edit-media" > mylogo_copy.png

Update

Resources may be updated by performing an HTTP PUT on the resource's edit media URL. A resource's edit media URL may be discovered by looking for the appropriate entry tag in the containing folder's Atom feed and then finding the link tag with rel="edit-media".

The body of the PUT consists of the contents of the file you wish to upload. The HTTP header Content-Type: must be set appropriately for the type of the file.

To update the image created above:

PUT http://example.com:8080/mylogo.png#rel=edit-media HTTP/1.1
Content-Type: image/png
Authorization: Digest username="john", realm="http://example.com:8080/", ...

The equivalent curl command is:

curl --digest --user john --upload-file "mylogo.png" -H "Content-Type: image/png" \
  "http://example.com:8080/mylogo.png#rel=edit-media"

Normal HTTP response codes are used to indicate success or failure of the request.

Delete

Resources may be deleted by performing an HTTP DELETE on the resource's edit media URL. A resource's URL may be discovered by looking for the appropriate entry tag in the containing folder's Atom feed and then finding the link tag with rel="edit-media".

To delete the image created above:

DELETE http://example.com:8080/mylogo.png#rel=edit-media HTTP/1.1
Authorization: Digest username="john", realm="http://example.com:8080/", ...

The equivalent curl command is:

curl --digest --user john -I -X DELETE "http://example.com:8080/mylogo.png#rel=edit-media"

Normal HTTP response codes are used to indicate success or failure of the request. In this case, a successful delete is indicated by a 204 (No Content) response.