-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDocumentUploadExample.java
29 lines (24 loc) · 1.11 KB
/
DocumentUploadExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import com.signnow.api.document.request.DocumentPostRequest;
import com.signnow.api.document.response.DocumentPostResponse;
import com.signnow.core.ApiClient;
import com.signnow.core.exception.SignNowApiException;
import com.signnow.core.factory.SdkFactory;
import java.io.File;
public class DocumentUploadExample {
public static void main(String[] args) {
// Set your actual input data here
// Note: following values are dummy, just for example
//----------------------------------------------------
// if it is not specified here, a new Bearer token will be created automatically
String bearerToken = "";
String pathToDocument = "/your/path/to/file.pdf";
try {
ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken);
DocumentPostRequest request = new DocumentPostRequest(new File(pathToDocument));
DocumentPostResponse response = (DocumentPostResponse) client.send(request).getResponse();
System.out.println("New document ID: " + response.getId());
} catch (SignNowApiException e) {
System.out.println("ERROR: " + e.getMessage());
}
}
}