Skip to content

Using the siegfried server

Richard Lehane edited this page Nov 22, 2016 · 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.

Default settings

When starting the server, you can use regular sf flags to set defaults for the nr, format, hash, z, and sig parameters that will apply to all requests unless overriden. Logging options can also be set.

E.g. sf -nr -z -hash md5 -sig pronom-tika.sig -log p,w,e -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);
  • POST request, where the file is sent over the network as form-data.

GET request

GET /identify/percent_encoded_file_or_folder_name?base64=false&nr=true&format=yaml&hash=md5&z=true&sig=default.sig

E.g. http://localhost:5138/identify/c%3A%2FUsers%2Frichardl%2FMy%20Documents%2Fhello%20world.docx?format=json

Parameters

base64 (optional) - use URL-safe base64 encoding for the file or folder name with base64=true.

nr (optional) - stop sub-directory recursion when a directory path is given with nr=true.

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

hash (optional) - calculate file checksum (md5, sha1, sha256, sha512, crc)

z (optional) - scan archive formats (zip, tar, gzip, warc, arc) with z=true. Default is false.

sig (optional) - load a specific signature file. Default is default.sig.

POST request

POST /identify?format=yaml&hash=md5&z=true&sig=default.sig Attach a file as form-data with the key "file".

E.g. curl "http://localhost:5138/identify?format=json&hash=crc" -F file=@myfile.doc

Parameters

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

hash (optional) - calculate file checksum (md5, sha1, sha256, sha512, crc)

z (optional) - scan archive formats (zip, tar, gzip, warc, arc) with z=true. Default is false.

sig (optional) - load a specific signature file. Default is default.sig.