This topic contains 4 replies, has 2 voices, and was last updated by  mwilliams 2 months, 2 weeks ago.

  • Author
    Posts
  • Participant
    23233737
    Newbie
    Member since: 06.02.2019
    Number of posts: 2

    I have this code as was suggested by OneSpan for retrieving “GetUpdatedPackagesWithinDateRange” but I am getting an error on this line.

    Page<DocumentPackage> 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<DocumentPackage> 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

    • This topic was modified 2 months, 2 weeks ago by  23233737.
    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 905

    Score

    0

    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 developer@esignlive.com and give me your account info. I’ll have support look into the issue about your account being suspended.


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120
    Participant
    23233737
    Newbie
    Member since: 06.02.2019
    Number of posts: 2

    Score

    0

    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

    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 905

    Score

    0

    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?


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120
    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 905

    Score

    0

    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.


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120

You must be logged in to reply to this topic.