wendyguo | Posts: 74

how to download a attachment via JAVA SDK call when the package is complete

0 votes

Hi,

Could you please let me know how to download a attachment via JAVA SDK call when the package is complete?

 

Thanks

Wendy


Duo_Liang | Posts: 3776

Reply to: how to download a attachment via JAVA SDK call when the package is complete

0 votes

Hi Wendy,

 

Java SDK offers below functions:


//Download A single attachment (requires the attachment id)
DownloadedFile downloadedAttachment = client.getAttachmentRequirementService().downloadAttachmentFile(packageId, attachmentId);
Files.saveTo(downloadedAttachment.getContents(), downloadedAttachment.getFilename());


//Download All attachments in a package
DownloadedFile downloadedAllAttachmentsForPackage = client.getAttachmentRequirementService().downloadAllAttachmentFilesForPackage(packageId);
Files.saveTo(downloadedAllAttachmentsForPackage.getContents(), "downloadedAllAttachmentsForPackage.zip");


//Download All attachments from a particular signer    
DownloadedFile downloadedAllAttachmentsForSigner1InPackage = client.getAttachmentRequirementService().downloadAllAttachmentFilesForSignerInPackage(myPackage, signer1);
Files.saveTo(downloadedAllAttachmentsForSigner1InPackage.getContents(), "downloadedAllAttachmentsForSigner.zip");

 

Duo


wendyguo | Posts: 74

Reply to:

0 votes

Hi Duo,

when create package with attachment with the below code:

.withSigner(newSignerWithEmail("[email protected]")
.withFirstName("John")
    .withLastName("Doe")
    .withCustomId("Signer1")
    .withAttachmentRequirement(newAttachmentRequirementWithName("Driver's license")
        .withDescription("Please upload a copy of your driver’s license.")
        .isRequiredAttachment() 

       .build()))

when download the attachment with the below code, how to find attachment id?

//Download A single attachment (requires the attachment id)
DownloadedFile downloadedAttachment = client.getAttachmentRequirementService().downloadAttachmentFile(packageId, attachmentId);
Files.saveTo(downloadedAttachment.getContents(), downloadedAttachment.getFilename());

Thanks

Wendy


Duo_Liang | Posts: 3776

Reply to: how to download a attachment via JAVA SDK call when the package is complete

0 votes

Hi Wendy,

 

Try to create the AttachmentRequirement object separately:
        AttachmentRequirement attachmentRequirement = AttachmentRequirementBuilder.newAttachmentRequirementWithName("Driver's license")
            .withDescription("Please upload a copy of your driver’s license.")
            .isRequiredAttachment() 
            .build();
        attachmentRequirement.setId("myAttachmentId");
        
        DocumentPackage superDuperPackage = newPackageNamed("Example Package")
                .withSigner(newSignerWithEmail("")
                        .withFirstName("firstName2")
                        .withLastName("lastName2")
                        .withAttachmentRequirement(attachmentRequirement)                    
                        )

               ......

 

 

Duo


rodrigo.carmona | Posts: 13

Reply to: how to download a attachment via JAVA SDK call when the package is complete

0 votes

Hi Duo!

I was facing a similar issue and take the AttachmentRequirement creation using a custom id.

In what state should the transaction be to get the attachement downloaded by the custom id?

I've created a transaction with id t-7Yt2FLAruJWcik9dd2ESFV28s=, but when try to download, get an 404 exception:

com.silanis.esl.sdk.internal.RequestException: HTTP GET on URI https://sandbox.esignlive.com/api/packages/t-7Yt2FLAruJWcik9dd2ESFV28s=/attachment/41ee5ebe-01b1-432c-b915-183d5fb6ef67popa resulted in response with status code: [404, Not Found]. Optional details: {"technical":"Attachment requirement with uid [41ee5ebe-01b1-432c-b915-183d5fb6ef67popa] doesn't exist.","messageKey":"error.notFound.attachmentRequirementNotFound","message":"[error.notFound.attachmentRequirementNotFound]","code":404,"name":"Resource Not Found"}

Thanks in advance.

RC.


Duo_Liang | Posts: 3776

Reply to:

0 votes

Hi rodrigo,

 

Can you send the package JSON to [email protected] so that I can have a closer look at your package setup? You could follow below two steps:
(1)Log onto your sender portal (e.g. https://sandbox.esignlive.com/a/login)

(2)Once you get a session, open a new tab and hit this link: https://sandbox.esignlive.com/api/packages/t-7Yt2FLAruJWcik9dd2ESFV28s=

 

Duo


rodrigo.carmona | Posts: 13

Reply to: how to download a attachment via JAVA SDK call when the package is complete

0 votes

Hi Duo.

Email sent 

Cheers.


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off