Record Deposit

REST Api operation which deposits the body of the http-put request on the Shared Records server. The record is stored anonymously.

Synopsis

Submit

PUT /<RESTServletPath>/<RecordID>.data HTTP/1.1
Host: <RESTHost:RESTPort>
Content-Type: <ContentType>
Content-Length: <ContentLength>
Content-MD5: <ContentHash>
x-amz-meta-<Option>: <Value>

Fields:

RESTServletPath
Path to the REST Servlet on the host. Example: records
RecordID
The unique ID of the stored record. (The SHA1 hash of the stored data)
RESTHost
IP address of Shared Records server. Example: sra.sharedrecords.org
RESTPort
Network port of the Shared Records server. Example: 8080 (port 80, the default, is preferred for sra.sharedrecords.org)

Headers:

Content-Type
A standard MIME type describing the format of the contents. If none is provided, the default is binary/octet-stream. For encrypted records the content type should always be binary/octet-stream. For unencrypted records the server will store this type and honor it when the record is returned to the client.
Content-Length
The size of the object, in bytes. (Required)
Content-MD5
An MD-5 hash of the object's value. This is used to verify integrity of the object in transport (not required).
Content-Disposition
Specifies presentational information for the object.
Content-Encoding
Specifies what content codings have been applied to the object and thus what decoding mechanisms must be applied in order to obtain the media-type referenced by the Content-Type header field.
x-amz-meta-<Option>
Any header starting with this prefix is considered user metadata. It will be stored with the record and returned when the record is retrieved.
x-amz-meta-record-file-extension
The original file extension of an encrypted record. The client can use this information to process the record after it has been unencrypted.
x-amz-meta-record-content-type
The original content type of an encrypted record. The client can use this information to process the record after it has been unencrypted if it can't find a file extension.
x-amz-meta-signature
A signature attached to the record. This is a Base64 encoded string of the signature, encrypted with the signer's private key.
x-amz-meta-signer
The signer of a record.

Body:

The body of the http-put should contain the (possibly encrypted) data to store on the Shared Records server.

Response

HTTP/1.1 100 Continue
HTTP/1.1 200 OK
X-Powered-By: Servlet/2.4
Content-Type: text/html; charset=iso-8859-1
Content-Length: 0

Examples

Command-line

The following command-line example uses the common unix "openssl" to generate the record-id and then the "curl" utility to upload a file named "original.txt" to the Shared Records server.

$ openssl dgst -sha1 original.txt

SHA1(original.txt)= 8e636b1c0af14814fc67748ab54a3aa7d01893fb

$ curl --verbose --upload-file original.txt http://sra.sharedrecords.org/records/8e636b1c0af14814fc67748ab54a3aa7d01893fb.data

Note: the "\" character is used to indicate that the line continues. To copy-and-paste this command, remove those characters and remove whitespace in the URI.

Notes

  • The UID passed in should be the SHA-1 hash of the data payload. If it is not, this operation will fail with a 412 (precondition failed)

  • The total size of the HTTP request, not including the body, must be less than 4 KB.