CSSv5.0.0 en:Automatic Download of Transfers: Unterschied zwischen den Versionen

Aus Cryptshare Documentation
Wechseln zu:Navigation, Suche
(Imported from text file)
(Improved formation)
 
Zeile 3: Zeile 3:
-----
-----


== 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:
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:
`https://<Cryptshare Server URL>/download?id=<transfer-id>&password=<password>&<get[=all|=checksums|allWithChecksums|=<file-id>]>`
`https://<Cryptshare Server URL>/download?id=<transfer-id>&password=<password>&<get[=all|=checksums|allWithChecksums|=<file-id>]>`{{InfoBox|title=|content=The URL below can still be used for the automated download of transfers, but will be deactivated with one of the next Cryptshare versions.
{{InfoBox|title=|content=The URL below can still be used for the automated download of transfers, but will be deactivated with one of the next Cryptshare versions.
`https://<Cryptshare Server URL>/download1.php?id=<transfer-id>&password=<passwort>&<get[=all|=checksums|allWithChecksums|=<file-id>]>`
`https://<Cryptshare Server URL>/download1.php?id=<transfer-id>&password=<passwort>&<get[=all|=checksums|allWithChecksums|=<file-id>]>`
}}
}}
Zeile 148: Zeile 148:


This way it is easily possible to identify the reason for a download failure when using this feature in automation scripts or API's.
This way it is easily possible to identify the reason for a download failure when using this feature in automation scripts or API's.
{{Panel|title=Related Knowledge Base Articles|content='''Error rendering macro 'sv-contentbylabel''''
null
}}


-----
-----

Aktuelle Version vom 7. September 2021, 12:28 Uhr



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:

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

The URL below can still be used for the automated download of transfers, but will be deactivated with one of the next Cryptshare versions. `https://<Cryptshare Server URL>/download1.php?id=<transfer-id>&password=<passwort>&<get[=all


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.