nehme | Posts: 153

List of Documents

0 votes

Hello,

How I can get the list of documents for a certain package using rest API call

 

Thanks 

Nehme


Duo_Liang | Posts: 3776

Reply to: List of Documents

0 votes

Hi Nehme,

 

You won't be able to get a list of documents directly with the GET /documents call, instead, you have to retrieve the complete package JSON first (GET /api/packages/{packageId}) then locate the "documents" node.

 

Duo


nehme | Posts: 153

Reply to:

0 votes

Hello Duo,

 

Thanks for your fast reply. What I am looking for it to list the documents for the clients based on their visibility and than on fly download the document the clients will click from the list. Any suggestions or code example help you already have it?

 

Thanks

Nehme


Duo_Liang | Posts: 3776

Reply to:

0 votes

Hi Nehme,

 

I see what you meant, if you are still using .NET SDK, DocumentVisibility class provides a function allowing you to get a document list based on signer visibility:

 

        public readonly string apiKey = "your_api_key";
        public readonly string apiUrl = "https://sandbox.esignlive.com/api";
        public readonly string packageId = "OA9bhoAF1IP55x-Lk56aL_AUpvI=";
        public readonly string roleId = "31f7c7c0-a76f-46df-9027-e8004e18a079";


        public void Execute() {
            EslClient eslClient = new EslClient(apiKey, apiUrl);
            DocumentPackage pkg = eslClient.GetPackage(new PackageId(packageId));

            DocumentVisibility dv = eslClient.getDocumentVisibility(new PackageId(packageId));
            List<Document> listWithVisibility = dv.GetDocuments(pkg,roleId);

            listWithVisibility.ForEach(i => Debug.WriteLine($"Document ID: {i.Id}; Document Name: {i.Name}"));
        }

If you have already got rid of SDK, I can help you create a code snippet based on the same logic.

 

Duo


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