gyurko

Trying to pull Packages from ESign regardless of Status

0 votes
I have a Dynamics CRM which matches the Statuses of the ESign Packages and I need to reconcile them. Right now there are 28 Transaction in my Inbox, 16 Documents in Draft, 0 Archived and 29 in Trash. That's 73 Transactions total. What I would like to do is Iterate through each Package and write to a CSV File some basic information including the CRM ID, the ESIgn ID, a PreOrder Number and the Status of the Package. I can then compare what I have in CRM and in ESign and see if there is anything off so that I can fix it before I have hundreds of Packages in ESign. I can Page through the List using: GetPackages = eslClient.PackageService.GetPackages(DocumentPackageStatus.DRAFT, new PageRequest(x, y)); and then do it again for each Status (ARCHIVED, COMPLETED, DECLINED, DRAFT, OPTED OUT and SENT) but that does not pull Trashed Packages. Also, I have to do each Status separately as opposed to something like: GetPackages = eslClient.PackageService.GetPackages(DocumentPackageStatus.Values().All, new PageRequest(x, y)); Can you please assist?

Approved Answer

Reply to: Trying to pull Packages from ESign regardless of Status

0 votes
So the answer is I need a separate call to get the Trashed Records. https://sandbox.esignlive.com/api/packages?from=0&to=99&query=trashed

Reply to: Trying to pull Packages from ESign regardless of Status

0 votes
Hi, Trashed is not a package status in eSignLive. I know it can be misleading because in the web portal we have a trashed folder. For every DocumentPackage object you retrieve, there is a trashed property you can check to verify if the package has been trashed or not.
DocumentPackage pkg = eslClient.GetPackage(packageId);
bool trashed = pkg.Trashed;
In addition, with the SDK you will have to retrieve packages by statuses. You can post in the enhancement ideas forum and I will forward your request to our product management team. Edit: You can retrieve all packages regardless of their status with our REST API. You could do something: GET https://sandbox.esignlive.com/api/packages?from=0&to=99 Which will return you the first 100 packages in your account.
Haris Haidary OneSpan Technical Consultant

Reply to: Trying to pull Packages from ESign regardless of Status

0 votes
Okay sounds great. Assume I know nothing about the REST API (because I don't). how can I make a Call to the REST API from within C# Code?

Reply to: Trying to pull Packages from ESign regardless of Status

0 votes
I went on to the Internet and think it should go something like this: var client = new WebClient(); client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"); client.Credentials.GetCredential(new Uri(ESignId), "AuthType"); var response = client.DownloadData("https://esignlive.com/api/packages?from=0&to=99"); Does that seem like I am on the right track? If so, I am not sure what the AuthType should be.

Reply to: Trying to pull Packages from ESign regardless of Status

0 votes
You can download the following code share to help you get started with the REST API in C#: https://developer.esignlive.com/code-share/package-management-rest-api/
Haris Haidary OneSpan Technical Consultant

Reply to: Trying to pull Packages from ESign regardless of Status

0 votes
Dear Haris, We are using Silanis.ESL1.2.10 in our project. All was working fine few months before. But now we are facing an issue during Document Downloading from eSignLive at below line. // Create new esl client with api token and base url EslClient eslClient = new EslClient(API_KEY, API_URL); Exception: {System.TypeInitializationException: The type initializer for 'log4net.Core.LoggerManager' threw an exception. ---> System.MethodAccessException: Attempt by method 'log4net.Core.LoggerManager.RegisterAppDomainEvents()' to access method 'System.AppDomain.add_ProcessExit(System.EventHandler)' failed. at log4net.Core.LoggerManager.RegisterAppDomainEvents() at log4net.Core.LoggerManager..cctor() --- End of inner exception stack trace --- at log4net.Core.LoggerManager.GetLogger(Assembly repositoryAssembly, String name) at log4net.LogManager.GetLogger(Assembly repositoryAssembly, String name) at log4net.LogManager.GetLogger(Type type) at Silanis.ESL.SDK.Support..ctor() at Silanis.ESL.SDK.EslClient..ctor(String apiKey, String baseUrl) at EmailDocForSignature.GetSignedDocStatus(PackageId id)} System.Exception {System.TypeInitializationException} Any help would be appreciated. Thanks

Reply to: Trying to pull Packages from ESign regardless of Status

0 votes
Thank you. That was helpful. But I am still not pulling Packages that have "trashed" = true. I have run the Get both in C# and using Postman and both results pull 49 Packages. That adds up to the 32 Packages I have in the InBox and the 17 Packages I have in Draft but does not include the 30 Packages that are in the Trash Folder. This is my Call: private static string GetData(string APIKey, Uri NewUri) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(NewUri); request.Headers.Add("Authorization", "Basic " + apiKey); using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { if (response.StatusCode != HttpStatusCode.OK) throw new Exception(String.Format("Server error (HTTP {0}: {1}).", response.StatusCode, response.StatusDescription)); String responseString = ""; using (Stream stream = response.GetResponseStream()) { StreamReader reader = new StreamReader(stream, Encoding.UTF8); responseString = reader.ReadToEnd(); } return responseString; } } What am I doing wrong?

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