Skip to content

Using the siegfried server

Richard Lehane edited this page Feb 24, 2015 · 17 revisions

Starting the server

The siegfried server is built into the sf tool. Simply run sf -serve and provide a hostname:port. E.g. sf -serve localhost:5138.

Identifying files

The siegfried server has two modes of identification: GET request, where a file or directory path is given in the URL and the server retrieves the file(s); or POST request, where the file is sent over the network as form-data. For GET requests, the file name or directory must be URL-safe base64 encoded.

GET request

GET /identify/base64_encoded_file_name_or_directory(?nr=true&format=csv|yaml|json)

E.g. http://localhost:5138/identify/YzpcTXkgRG9jdW1lbnRzXGhlbGxvX3dvcmxkLmRvYw==

Parameters

nr (optional) - this parameter can be used to stop sub-directory recursion when a directory path is given.

format (optional) - this parameter can be used to select the output format (csv, yaml, json). Default is json. Alternatively, HTTP content negotiation can be used.

POST request

POST /identify(?format=csv|yaml|json) Attach a file as form-data with the key "file".

E.g. curl localhost:5138/identify -F [email protected]

Parameters

format (optional) - this parameter can be used to select the output format (csv, yaml, json). Default is json. Alternatively, HTTP content negotiation can be used.

Archivematica integration

The siegfried server can be used as an identification tool within an Archivematica workflow. Here is an example Format Policy Registry script for using siegfried in this way:

<script src="https://gist.github.com/richardlehane/b0d8c304f8b52685f26d.js"></script>
Clone this wiki locally