CSSCurrent en:Automatic Download of Transfers

Aus Cryptshare Documentation
Version vom 1. Februar 2023, 08:15 Uhr von imported>Frorathm
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu:Navigation, Suche



Automatic Download of Transfers

For automation processes it is possible to download a Cryptshare transfer directly without the need to operate the user interface manually. To do this, the additional GET parameter 'get' has to be appended to the link URL:

New: https://<Cryptshare Server URL>/download?id=<transfer-id>&password=<password>&<get[=all|=checksums|=allWithChecksums|=<file-id>]>


Old: https://<Cryptshare Server URL>/download1.php?id=<transfer-id>&password=<passwort>&<get[=all|=checksums|allWithChecksums|=<file-id>]>

The old URL is still working, but will be removed with future release.

Retrieving Meta-Information about a transfer

Attaching the 'get' parameter only results in an HTTP download offering a TXT document with information about the transfer. The information is offered in a JSON compatible manner. Structure JSON file (example data):

{  
   "file_1":[  
      {  
         "6ac31d4b8b":[  
            "transferFile_1.txt"
         ],
         "size":[  
            0
         ],
         "sha1":[  
            ""
         ],
		 "checksum":[  
            "0a28b295a883e4122c36482e4b0ad2275bbd2ebd60d066dc6f9e7fe6922ad7f4"
         ],
		 "checksumAlgorithm":[  
            "SHA-256"
         ]
      }
   ],
   "file_2":[  
      {  
         "4f0109ad8b":[  
            "transferFile_2.txt"
         ],
         "size":[  
            0
         ],
  	     "sha1":[  
            ""
         ],
         "checksum":[  
            "32d9c815c2c3cf989007b613d37844d919a1e7070b67a501150d760ac860505e"
         ],
		 "checksumAlgorithm":[  
            "SHA-256"
         ]
       
      }
   ],
   "totalSize":[  
      0
   ]
}

`https://<Cryptshare Server URL>/download?id=234ds43re&password=23erwr2er&get` The file lists all files within this transfer together with their corresponding File-IDs. This provides the possibility to find a specific file and download this file with a separate call.

Downloading specific files

Attaching the 'get' parameter together with a specific file id results in an HTTP download offering the file which corresponds to this id. `https://cryptshare.yourdomain.com/download?id=234ds43re&password=23erwr2er&get=6ac31d4b8b` Using our example from above this call will download the file 'transferFile_1.txt'.

Downloading all the files of a transfer

Attaching the 'get' parameter together with the key word 'all', results in a HTTP download offering a zip file containing all the files of the transfer. `https://cryptshare.ihredomain.de/download?id=234ds43re&password=23erwr2er&get=all` This call will download the file 'cs_transfer.zip' which, according to the meta information, will contain the files 'transferFile_1.txt' and 'transferFile_2.txt'.

Downloading the checksums of the files of a transfer

Attaching the 'get' parameter together with the key word 'checksums', results in a HTTP download offering a csv file containing information of the transfer. This information contains the notification subject of the transfer and the file names and their corresponding checksums. `https://cryptshare.ihredomain.de/download?id=234ds43re&password=23erwr2er&get=checksums` This call will download the file 'checksums.csv' which, according to the meta information, will contain the following entries:

File Name Checksum
transferFile_1.txt 0a28b295a883e4122c36482e4b0ad2275bbd2ebd60d066dc6f9e7fe6922ad7f4 (SHA-256)
transferFile_2.txt 32d9c815c2c3cf989007b613d37844d919a1e7070b67a501150d760ac860505e (SHA-256)

Downloading all the files of a transfer

Attaching the 'get' parameter together with the key word 'allWithChecksums', results in a HTTP download offering a zip file containing all the files of the transfer and a csv file containing the checksums of the transfer's files. `https://cryptshare.ihredomain.de/download?id=234ds43re&password=23erwr2er&get=allWithChecksums` This call will download the file 'cs_transfer.zip' which, according to the meta information, will contain the files 'transferFile_1.txt', 'transferFile_2.txt' and 'checksums.csv'.

HTTP error codes and messages

The Cryptshare User Interface will behave differently when using the 'get' parameter and offering wrong parameters. Unlike the error messages usually presented when downloading files via the web form, the interface will respond with the HTTP error code and the corresponding error message based on the error case.

Situation Code Code Description
  • There was no transfer-id specified
  • There was no password specified
400 Bad Request
  • The transfer-id was not found
  • There are no transfer files available
  • The transfer was deleted.
  • The file-id was not found
404 Not found
  • The authentication failed
401 Unauthorized
  • The transfer was deleted because of wrong authentication with this request
410 Gone
  • The transfer was already locked
  • The transfer was locked because of wrong authentication
403 Forbidden
  • The download of the transfer requires an ID provider authentication. Currently, such transfers can't be retrieved using this download interface.
412 Precondition failed
  • Successful call
200 OK

This way it is easily possible to identify the reason for a download failure when using this feature in automation scripts or API's.