aparna | Posts: 9

Retrieving documentId

0 votes
Hello, I want to download document which is attached to package. I have package Id. String response = sdk.createPackage(pkg,blobMap); This above function is returning me package id. But not able to find any function which returns me document id based on document Name. Please could you tell me how to do this in Apex SDK. Thanks

harishaidary | Posts: 1812

Reply to: Retrieving documentId

0 votes
The UploadDocument method takes a DocumentPackage and PackageId object as parameters. I'm guessing "pkg" is your PackageId object. PackageId doesn't have a GetDocument() method. Try doing it this way:
Document buildDoc = DocumentBuilder.NewDocumentNamed(fileName)
                    .FromStream(stream, DocumentType.PDF).Build();

eslClient.UploadDocument(buildDoc, pkg);
Document doc2 = eslClient.GetPackage(pkg).GetDocument(fileName);

return doc2.Id;

csabo | Posts: 40

Reply to: Retrieving documentId

0 votes
Haris, What you gave me worked, after I realized that the uploadDocument call was stripping off the file extension. My filename was testing.pdf. So, I was searching for testing.pdf and not finding results. Removing the .pdf from the GetDocument call returned results. Maybe a note in the knowledgebase about that would be helpful. Thanks! Colleen

harishaidary | Posts: 1812

Reply to: Retrieving documentId

0 votes
Yes the ".pdf" extension does get trimmed off the name when you upload your PDF document to eSignLive. I apologize if this wasn't clear in our documentation. We are actively working on improving it and you'll see updates very soon :)

harishaidary | Posts: 1812

Reply to: Retrieving documentId

0 votes
Hi aparna, With eSignLive, you have the ability to assign ids to your documents during package creation. This makes data retrieval trivial. Here's an example on how to assign an id to a document.
ESignLiveAPIObjects.Document document = new ESignLiveAPIObjects.Document();
document.name = 'Sample Contract';
document.id = 'document1';
Otherwise, you'll have to use the getPackage() method from the SDK and look inside the Document object to retrieve the ids.

aparna | Posts: 9

Reply to: Retrieving documentId

0 votes
Hello, I have created document with document Id as shown below: ESignLiveAPIObjects.Document doc1 = new ESignLiveAPIObjects.Document(); doc1.name = 'testDocumentOne'; doc1.id='Id1'; String response = sdk.createPackage(pkg,blobMap); Blob sample = downloadDocumentExample(response,'Id1'); But i am getting below error: ESignLiveRESTAPIHelper.ESignLiveRestAPIHelperException: Error obtaining signed eSignLive document: 500 - Internal Server Error - {"messageKey":"error.internal.default","technical":"[#b9a220a3-d344-4758-969f-a7176104bb52]","message":"Unexpected error. We apologize for any inconvenience this may have caused you, please try again. If the problem persists, please contact our support team.","code":500,"name":"Unhandled Server Error"} I am not able to download document. Please help.

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