Home > Developer
Developer Reference

   Home : Developer Reference

Storage API : GetChecksum

GetChecksum

Script path: /storage/bin/api/get_checksum.cgi

Description: Get the MD5 checksum of a file and optionally request to verify it against a given the MD5 checksum.

INPUT (via GET or POST)

Mandatory parameters are: sid, path
Optional parameters are: checksum

sid session id of the login user. [mandatory]
path path to a file [mandatory]

Please refer to [How to specify a path].

path must point to an existing file.

e.g.
path=/Private/MyFile.avi  - get checksum of file MyFile.avi in "Private" area

 

checksum =<MD5_checksum>
If checksum is not specified, it is taken to mean to just return the MD5 checksum of the file.
If checksum is specified, it is taken to mean to verify the file's checksum against it and return a match or unmatch status. MD5_checksum is represented as 32 hex digits in an ascii string of 32
characters (lowercased). MD5 is a 32-bit checksum (fingerprint or message digest) of a file.

OUTPUT (content-type: text/plain)

Successful return:

(WHEN REQUESTING for checksum)

true <TAB> <MD5_checksum> <newline>

e.g.

true <TAB> 132987c6ea9a9dfa1e0ccb79eae16af6

 

(WHEN VERIFYING against a given checksum)

true<TAB><Server_MD5_checksum><TAB><match|unmatch><newline>

e.g.

true <TAB> 132987c6ea9a9dfa1e0ccb79eae16af6 <TAB> match

true <TAB> 132987c6ea9a9dfa1e0ccb79eae16af6 <TAB> unmatch

 

Unsuccessful return:

false<tab><error message><newline>

e.g.

false <TAB> File does not exist.