Skip to main content
Solved

REST API times out after 10 minutes

  • October 11, 2024
  • 6 replies
  • 149 views

Hello! I am trying to pull all historical Sale Orders via the REST API. Given that we have a lot of orders, the request takes over 10 minutes. However, I noticed that every time I run the request, I hit this error around the 10 minute mark:

If I add a time filter, eg get all Sales Orders after some date, the api returns results as long as it finishes in under 10 minutes. Anyone know what’s going on? Is there a way to set the timeout to be > 10 minutes?

[OperationCanceledException: Operation Cancelled]
   PX.Data.PXCancellationToken.CheckCancellation() +197
   PX.Data.PXAccess.GetConnectionString() +15
   PX.Data.PXDatabase.get_Provider() +143
   PX.Data.PXViewQueryCollection.Unload() +87
   PX.Data.PXGraphQueryCacheCollection.Unload() +105
   PX.Data.PXGraph.Unload() +2267
   PX.Api.ContractBased.EntityExportContextBuilder.Dispose() +49
   PX.Api.ContractBased.<GetListAsyncFromEnumerable&gt;d__8.MoveNext() +2117
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.Api.ContractBased.SystemContracts.V2.&lt;PX-Api-ContractBased-IRestGate-GetListAsync&gt;d__4.MoveNext() +346
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Threading.Tasks.&lt;CastToObject&gt;d__1`1.MoveNext() +234
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.Controllers.&lt;InvokeActionAsyncCore&gt;d__1.MoveNext() +300
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.Filters.&lt;CallOnActionExecutedAsync&gt;d__6.MoveNext() +307
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Web.Http.Filters.&lt;CallOnActionExecutedAsync&gt;d__6.MoveNext() +729
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.Filters.&lt;ExecuteActionFilterAsyncCore&gt;d__5.MoveNext() +435
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.Controllers.&lt;ExecuteAsync&gt;d__5.MoveNext() +836
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.Filters.&lt;ExecuteAuthorizationFilterAsyncCore&gt;d__3.MoveNext() +422
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.Controllers.&lt;ExecuteAsync&gt;d__6.MoveNext() +263
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Web.Http.Controllers.&lt;ExecuteAsync&gt;d__6.MoveNext() +1373
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.Dispatcher.&lt;SendAsync&gt;d__15.MoveNext() +1405
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.&lt;SendAsync&gt;d__24.MoveNext() +1386
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.Owin.&lt;InvokeCore&gt;d__20.MoveNext() +777
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Http.Owin.&lt;InvokeCore&gt;d__20.MoveNext() +2176
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.Logging.Enrichers.&lt;&lt;DisableAspNetCallbackEnricher&gt;b__0_0&gt;d.MoveNext() +230
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNetCore.Routing.&lt;Invoke&gt;d__3.MoveNext() +399
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNetCore.Builder.Extensions.&lt;Invoke&gt;d__3.MoveNext() +804
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNetCore.Builder.Extensions.&lt;Invoke&gt;d__3.MoveNext() +489
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNetCore.Builder.&lt;&lt;UseAsyncStackOverflowGuard&gt;b__0_0&gt;d.MoveNext() +225
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   Microsoft.AspNetCore.Builder.&lt;&lt;UseAsyncStackOverflowGuard&gt;b__0_0&gt;d.MoveNext() +399
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNetCore.Builder.&lt;&lt;UseSessionContextFactory&gt;b__6_0&gt;d.MoveNext() +314
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.Telemetry.&lt;PreRequestHandlerExecute&gt;d__6.MoveNext() +210
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.&lt;RunApp&gt;d__7.MoveNext() +197
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNetCore.Builder.&lt;&lt;UseLicenseApiUserLimits&gt;b__0&gt;d.MoveNext() +428
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.Telemetry.&lt;PostAcquireRequestState&gt;d__5.MoveNext() +237
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.&lt;RunApp&gt;d__7.MoveNext() +197
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.&lt;RunApp&gt;d__7.MoveNext() +197
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.&lt;RunApp&gt;d__7.MoveNext() +197
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Mapping.&lt;Invoke&gt;d__3.MoveNext() +861
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.&lt;RunApp&gt;d__7.MoveNext() +197
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.&lt;RunApp&gt;d__7.MoveNext() +197
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.ResourceGovernor.&lt;PostAuthenticateRequest&gt;d__3.MoveNext() +351
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.Telemetry.&lt;PostAuthenticateRequest&gt;d__3.MoveNext() +213
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.&lt;RunApp&gt;d__7.MoveNext() +197
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.AspNetCore.Authentication.&lt;Invoke&gt;d__4.MoveNext() +1437
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNetCore.Builder.&lt;&lt;UseApplicationBeginEnd&gt;b__2_0&gt;d.MoveNext() +232
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNetCore.Builder.&lt;&lt;UseLicenseRequestThrottling&gt;b__0&gt;d.MoveNext() +439
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.ResourceGovernor.&lt;AuthenticateRequest&gt;d__2.MoveNext() +214
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   ResourceGovernor.&lt;AuthenticateRequest&gt;d__2.MoveNext() +237
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.Telemetry.&lt;AuthenticateRequest&gt;d__2.MoveNext() +237
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNetCore.Routing.&lt;Invoke&gt;d__6.MoveNext() +661
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.AspNetCore.Owin.&lt;&lt;InitInterleavedPipeline&gt;b__1&gt;d.MoveNext() +805
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   PX.Owin.&lt;&lt;ConfigurationImpl&gt;b__10_0&gt;d.MoveNext() +370
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Owin.&lt;&lt;RegisterAutofacLifetimeScopeInjector&gt;b__0&gt;d.MoveNext() +485
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14239541
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.&lt;RunApp&gt;d__7.MoveNext() +197
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.&lt;DoFinalWork&gt;d__12.MoveNext() +192
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +118
   System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +510
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +220
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +134

 

Best answer by Dmitrii Naumov

@definitesteve you can use top and skip parameter.

https://help.acumatica.com/(W(3))/Wiki/ShowWiki.aspx?pageid=12ecc8c7-b0c0-4f26-bfe5-388be9674374

https://help.acumatica.com/(W(4))/Wiki/ShowWiki.aspx?pageid=be37b0cb-eb17-41c0-944c-d52f7a65cf2e

https://help.acumatica.com/(W(2))/Help?ScreenId=ShowWiki&pageid=0ea8ce7c-4423-4286-a481-37e7261cc30f

View original
Did this topic help you find an answer to your question?

6 replies

Kulvir Kaila
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • 61 replies
  • October 12, 2024

Where are you running your REST API calls from?  For example, running integrations from Azure Functions will timeout after 10 minutes under their consumption plan.


  • Author
  • Freshman I
  • 5 replies
  • October 13, 2024

I am running locally using Python requests module. Even if I change the timeout in the request, I still run into the same error so it seems to be happening on the Acumatica end.


  • Author
  • Freshman I
  • 5 replies
  • October 14, 2024

I’m seeing this in the docs: https://help.acumatica.com/(W(3))/Help?ScreenId=ShowWiki&pageid=7a796856-3dec-4a4f-abf8-171324c9642b
 

The request will be declined only if the number of requests in the internal queue is greater than 20, or the request remains in the queue for more than 10 minutes. Acumatica ERP gives no indication that a request is added to the queue or being processed; the application that makes a request should stay connected and wait for the response. 

Wondering if there is way around this? Getting all out sales orders from the rest api takes more than 10 minutes since we have several years of data. Another option would be to chunk our requests (eg get records by month), but first wanted to see if this 10 min timeout is configurable. 


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 632 replies
  • October 15, 2024

@definitesteve it depends on where the instance is hosted. If it’s self-hosted or a private cloud, it can be increased in web.config file.

 

If it’s Acumatica cloud, it can be requested via a support case, but I doubt the justification is enough for the increase.

Generally increasing the timeout is not a recommended approach and instead getting the data in chucks is recommended. You can use ‘top’ and ‘skip’ parameters to limit the dataset you get in a single request.  


  • Author
  • Freshman I
  • 5 replies
  • October 15, 2024

@Dmitrii Naumov got it. Is there any pagination parameter in the REST API to paginate through chunks of a request? My current method is to slice requests by date, but it can get a little tricky if I don’t know the starting dates ahead of time. 


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 632 replies
  • Answer
  • October 15, 2024

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings