demellor

Custom Completion Report

0 votes

Until recently this worked with 1000 per page but NOW I had to do 250 to get it to work correctly, why?  I tried 500 and it failed just like 1000.  Are the OneSpan service side resources to consumed or what's going on that it now fails? (this is similar to the last Forum issue I submitted where the API is now more limited with more recent versions using the API)

 

private IList<RESTPackage> customDownloadCompletionReport(string dps, DateTime startDate, DateTime endDate, string apiKey, string apiUrl)
       {
           var results = new List<RESTPackage>();
           var response = new HttpResponseMessage(); //create as a temp filler 9/28/23
           var response2 = new HttpResponseMessage(); //create as a temp filler 9/28/23

           int totalSenderCount = 0;
           int curSenderIndex = 0;
           int senderPageNumber = 250; //was 1000, but gave ASync errors with newer OneSpan (RLD)


           do
           {
               HttpClient myClient = new HttpClient();
               myClient.Timeout= TimeSpan.FromMinutes(10); //default 100seconds
               myClient.DefaultRequestHeaders.Add("Authorization", "Basic " + apiKey);
               myClient.DefaultRequestHeaders.Add("Accept", "application/json");

               int maxRetry = 3;
               while (maxRetry-- > 0)
               {
                   try
                   {
                       response = myClient.GetAsync(new Uri(apiUrl + $"/reports/sender-transaction-summary?startDate={dateToIsoUtcFormat(startDate)}&endDate={dateToIsoUtcFormat(endDate)}&from={curSenderIndex + 1}&to={curSenderIndex + senderPageNumber}")).Result;
                       break;
                   }
                   catch (Exception e)
                   {
                       UpdateStatus("GetASync Reports "+e.Message); //logging
                       if (maxRetry == 0)
                       {
                           throw e;
                       }
                   }
               }

       

Richard DeMello


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