How I can get the list of documents for a certain package using rest API call
Thanks
Nehme
June 15Created
June 15Last Updated
3 years agoLast Reply
3Replies
58Views
2Users
0Likes
0Links
Duo_Liang | Posts: 3776
Reply to: List of Documents
Tuesday, June 15, 2021 at 09:31am
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.
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?
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);
Reply to: List of Documents
Tuesday, June 15, 2021 at 09:31amHi 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
Reply to: Hi Nehme, You won't be…
Tuesday, June 15, 2021 at 09:39amHello 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
Reply to: Hello Duo, Thanks for…
Tuesday, June 15, 2021 at 10:32amHi 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