Java
Chilkat2 Java
Yousign: Download File to Memory
See more Yousign Examples
Downloads a previously uploaded Yousign file (PDF) to memory.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.BinData;
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Http;
public class ChilkatExample {
public static void main(String[] args) {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Http http = new Http();
// Adds the "Authorization: Bearer YOUR_API_KEY" header.
http.setAuthToken("YOUR_API_KEY");
String downloadUrl = "https://staging-api.yousign.com/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/download?alt=media";
BinData pdfData = new BinData();
try {
http.downloadBd(downloadUrl, pdfData);
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
// Your application may now access the data contained in "pdfData".
System.out.println("Success");
}
}