REST API request time out.

skymak
Kilo Contributor

Hi,

We are using REST API table endpoint for sys_audit table to get the data from ServiceNow, but it is timing out with an 500 Internal Server Error. Following is the error response:

{

      "error": {

              "detail": "Transaction cancelled: maximum execution time exceeded Check logs for error trace or enable glide.rest.debug property to verify REST request processing",

              "message": "com.glide.sys.TransactionCancelledException: Transaction cancelled: maximum execution time exceeded"

      },

      "status": "failure"

}

Once we get this HTTP response from ServiceNow REST API for sys_audit table, all our calls for other tables return with HTTP code 202 and there is no data in response for a few minutes. We also tried to limit the query breadth by limiting it using sys_created_on but we are still getting error code 500 for sys_audit table.

Thanks,

Malik Lalani.

8 REPLIES 8

vab_13
ServiceNow Employee
ServiceNow Employee

Couple of things to check here:



1. What is the returned-data size of your transaction via GET


2. Search query vs indexes on the table


3. There is a 60 seconds OOB timeout, is your query taking more than 60 seconds? What can be done to reduce that?



This 60 seconds timeout can be increased, but personally, I wouldn't recommend that.


I would be more focused on addressing:



Why is it taking so much time?


What can be done to optimise?


I have the same problem here.



The query looks as follows:


//api/now/table/incident?sysparm_query=ORDERBYsys_updated_on&sysparm_limit=1000&sysparm_offset=0&sysparm_display_value=true




The main problem is that I cannot change this query as it is hard coded.


Can you try and fix the sorting algorithm in service now to work in default timeout settings? Sorting is something which should work for top 1000 elements I would say. Thnx for your help.



I also tried limit=10 but same problem.


vab_13
ServiceNow Employee
ServiceNow Employee

Default quota rules



  • REST Import Set API request timeout: Prevents inbound REST Import Set API transactions from running for longer than 60 seconds.
  • REST Table API request timeout: Prevents inbound REST Table API transactions from running for longer than 60 seconds.
  • REST Aggregate API request timeout: Prevents inbound REST Aggregate API transactions from running for longer than 60 seconds.
  • REST Attachment API request timeout: Prevents inbound REST Import Set API transactions from running for longer than 60 seconds.


Here you might be hitting REST Table API request timeout.


skymak
Kilo Contributor

Hi Vab,



Thanks a lot for your response. Current timeout is 5 minutes, but the query is taking longer than that. Can you guide on how can we optimize the query to return faster?



Thanks,


Malik Lalani.