23233737 | Posts: 2

GetUpdatedPackagesWithinDateRange Error message

0 votes
I have this code as was suggested by OneSpan for retrieving "GetUpdatedPackagesWithinDateRange" but I am getting an error on this line. Page completed_packages = eslClient.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus.SENT, new PageRequest(index, 10), DateTime.Now.AddDays(-10), DateTime.Now); using System; using System.Threading; using Silanis.ESL.SDK; using System.Diagnostics; using System.IO; namespace GetDocumentsFromELive { class LoadFiles { private static String apiUrl = "https://sandbox.esignlive.com"; private static string apiKey = "api_keys"; public static void Main(string[] args) { EslClient eslClient = new EslClient(apiKey, apiUrl); int index = 1; Page completed_packages = eslClient.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus.SENT, new PageRequest(index, 10), DateTime.Now.AddDays(-10), DateTime.Now); while (index = completed_packages.TotalElements) { foreach (DocumentPackage package in completed_packages) { Debug.WriteLine("Downloading package: " + package.Id + "..."); byte[] zipContent = eslClient.DownloadZippedDocuments(package.Id); File.WriteAllBytes(Directory.GetCurrentDirectory() + "/package-documents-" + package.Id.ToString() + ".zip", zipContent); index++; Thread.Sleep(1000); } completed_packages = eslClient.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus.COMPLETED, new PageRequest(index, 50), DateTime.Today.AddDays(-7), DateTime.Now); } } } } ---------------------------------- Silanis.ESL.SDK.EslException was unhandled HResult=-2146233088 Message=Could not get package list. Exception: Object reference not set to an instance of an object. Source=Silanis.ESL StackTrace: at Silanis.ESL.SDK.Services.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus status, PageRequest request, DateTime from, DateTime to) at DownloadDocumentsDateRange.DownloadDocuments.Main(String[] args) in H:\Code\Downloader\eSignLiveDocumentDownload\DownloadDocumentsNet.cs:line 24 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: HResult=-2147467261 Message=Object reference not set to an instance of an object. Source=Silanis.ESL StackTrace: at Silanis.ESL.SDK.Internal.HttpMethods.GetHttpJson(String apiToken, String path, String acceptType) at Silanis.ESL.SDK.RestClient.Get(String path) at Silanis.ESL.SDK.Services.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus status, PageRequest request, DateTime from, DateTime to) InnerException: ------------------------------------------------------------- Above is the error I was getting on my work computer Network. When I ran the same code on my private laptop, I got different error messages like the one below: -------------------------------------------------------------- Silanis.ESL.SDK.EslServerException occurred HResult=0x80131500 Message=Could not get package list. Exception: The remote server returned an error: (401) Unauthorized. HTTP GET on URI https://sandbox.esignlive.com/packages?query=SENT&from=1&to=10&lastUpdatedStartDate=2019-01-28T14:46:01Z&lastUpdatedEndDate=2019-02-07T14:46:01Z. Optional details: {"messageKey":"error.unauthorised.accountSuspended","code":401,"name":"Unauthorized","message":"Cannot create session with suspended account."} Source=Silanis.ESL StackTrace: at Silanis.ESL.SDK.Services.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus status, PageRequest request, DateTime from, DateTime to) at GetDocumentsFromELive.Program.Main(String[] args) in C:\dev\ECM\GetDocumentsFromELive\GetDocumentsFromELive\LoadFiles.cs:line 27 Inner Exception 1: EslServerException: The remote server returned an error: (401) Unauthorized. HTTP GET on URI https://sandbox.esignlive.com/packages?query=SENT&from=1&to=10&lastUpdatedStartDate=2019-01-28T14:46:01Z&lastUpdatedEndDate=2019-02-07T14:46:01Z. Optional details: {"messageKey":"error.unauthorised.accountSuspended","code":401,"name":"Unauthorized","message":"Cannot create session with suspended account."} Inner Exception 2: WebException: The remote server returned an error: (401) Unauthorized. ------------------------------------- Please any contribution will be helpful. Thanks! Nick

mwilliams | Posts: 957

Reply to: GetUpdatedPackagesWithinDateRange Error message

0 votes
Hey Nick, Is the OneSpan Sign account you're using set up under the same email address as the one you're registered with on this site? If not, can you email [email protected] and give me your account info. I'll have support look into the issue about your account being suspended.

23233737 | Posts: 2

Reply to: GetUpdatedPackagesWithinDateRange Error message

0 votes
Hi Michael, No, I am using a different account, and I have sent you an email to your question. Thanks for the quick reply. Nick

mwilliams | Posts: 957

Reply to: GetUpdatedPackagesWithinDateRange Error message

0 votes
I got your email. I'll have support look into it on US Sandbox. That's what I see in the above post. Nothing on the Fedramp instance that we're talking about, correct? All in sandbox.esignlive.com?

mwilliams | Posts: 957

Reply to: GetUpdatedPackagesWithinDateRange Error message

0 votes
Nick, The email address you sent me doesn't have an account on US Sandbox. Do you know what email address the account you're trying to use is registered under? I will email you the same question.

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