CSJCurrent en:Transfer Polling

Aus Cryptshare Documentation
Wechseln zu:Navigation, Suche

Transfer Polling

You can use the Java API Client's method requestActiveTransfers() to obtain a list of all active transfers that have been sent to the client's email address. With this request you receive all transfers where the client's email address is the recipient of these transfers. The client has to be verified for this method to succeed. The method will return a map, with the transfer IDs as keys, and the corresponding download urls (without the password) as values. The parameter id contains the transfer's transfer id in the following format: https://cryptshare.server.com/download?id=33d03d8d6b

Example: Request active transfers

// First create the Client instance
// Create a WebServiceUri for your Cryptshare Server 
WebServiceUri serviceUri = new WebServiceUri("https://cryptshare.server.com");
// Create a CryptshareConnection instance for your WebServiceUri
CryptshareConnection connection = new CryptshareConnection(serviceUri);
// Create the Client instance with the email address of the recipient, for which you want to get the transfers, 
// the CryptshareConnection, and the path to the verification store.
Client client = new Client("John.Doe@server.com", connection, Paths.get("C:\\\\temp"));

// Request the active transfers for this client
// Returns a Map containing all transfer ids and download urls for all active transfers that were sent to this client's 
// email address (in this example: "John.Doe@server.com"). 
// This method will throw an exception if the client/email address has not been verified.
Map<String, String> transferIdMap = client.requestActiveTransfers();

for (Entry<String, String> entry : transferIdMap.entrySet()) {
    System.out.println("Entry in transfer id map: transfer id = " + entry.getKey() + " url = " + entry.getValue());