File/stamp

From SafeStamper API documentation
Revision as of 03:13, 3 June 2022 by api>Admin (→‎Parameters)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sends a file to certificate.

It must use an HTTP multipart/form-data post request.

URL

https://www.safestamper.com/api/file/stamp

Parameters

  • sharedkey: Your API client shared key
  • authkey: Authkey to certificate as authorized user.
  • file: File to certificate
  • storefile: Indicate if store file in SafeStamper server ("true"|"false")
  • signature: Parameters signature, as explained in Signature parameter
    • NOTE: When calculating the signature use the file name as the value of file parameter

Returns

A JSON object with the following fields:

  • entryDate: Date of certificate
  • code: Code of certificate,
  • url: URL of certificate download
  • properties: JSON with the properties the certificate
    • filename: File name of the certificate
    • size: Size of file of the certificate (returned as a string)
    • md5: MD5 hash of file of the certificate
    • sha1: SHA1 hash of file of the certificate
    • sha256: SHA256 hash of file of the certificate
    • sha512: SHA512 hash of file of the certificate

HTTP Errors

  • 401 Unauthorized, the authkey is not valid
  • 403 Forbidden, the sharedkey or signature are not valid
  • 429 Your Safe Stamper user has no certification credits available
  • 430 Your Safe Stamper user has no storage space available

Example

REQUEST:

https://www.safestamper.com/api/file/stamp

Content-Type: multipart/form-data;
boundary=90503bb6-f5b0-410f-97da-e86041ce17cd
--90503bb6-f5b0-410f-97da-e86041ce17cd
Content-Disposition: form-data; name="authkey"

0dbb406d-cc0c-4ef8-ae80-971ed108c2f9
--90503bb6-f5b0-410f-97da-e86041ce17cd
Content-Disposition: form-data; name="storefile"

true
--90503bb6-f5b0-410f-97da-e86041ce17cd
Content-Disposition: form-data; name="sharedkey"

axvmfqn8aex21mxhq5zsj7l482saxfu7j4hh
--90503bb6-f5b0-410f-97da-e86041ce17cd
Content-Disposition: form-data; name="signature"

508c8bf78d43577f1d41db0c7a3c67c07518681c
--90503bb6-f5b0-410f-97da-e86041ce17cd
Content-Disposition: form-data; name="file"; filename="test.file"
Content-Type: null

<<< Contents of file >>>
 
--90503bb6-f5b0-410f-97da-e86041ce17cd--

RESPONSE:

{
    "entryDate":"2016-12-05T10:49:11Z",
    "code":"161205-4MR4ML",
    "url":"http://www.safestamper.com/certificate/161205-4MR4ML",
    "properties": {
        "filename":"test.file",
        "size":"3070",
        "md5":"9f7c1b879255cf5661f721d4fec6cbf2",
        "sha1":"7baf9446524cb1886f17fbd9756102b44d85585f",
        "sha256":"b42468bd6afa45d8f64c042fc116409748cdaf0214c47d8ad43aa4728ece7c03",
        "sha512":"5d04ec2d846141d2dcbc8d1d2629709dc63b8bf5b9f0e49836db527ae11c4b10ce797e184b8fa5fb0755fc444c62a93af0b0174c4d8ef68d82fe977a52dd4079"         
    }
}