How to avoid the timeout error in Rest API request

ramesh_r
Mega Sage

Hi All,

When i am running the Rest API its getting below error, but its working fine in the Postman.

Please help me how to avoid this error

Error: -

org.apache.commons.httpclient.ConnectTimeoutException: The host did not accept the connection within timeout of 10000 ms when posting to http://199.16.197.107:808/service/features

 

find_real_file.png

 

Thanks

Ramesh R

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Ramesh,

you can try increasing the timeout for Outbound REST.

  • Property: glide.http.outbound.max_timeout
  • Description: Specifies the number of seconds that RESTMessageV2 and SOAPMessageV2 APIs wait for a response from a synchronous call. The maximum value is 30 seconds.

How to increase the timeout for a REST response? (ECCResponseTimeoutException)

https://hi.service-now.com/kb_view.do?sysparm_article=KB0694711

Another method is while you are consuming the Rest message using script you can use this method

setHttpTimeout(Number timeoutMs)

https://developer.servicenow.com/dev.do#!/reference/api/orlando/server/sn_ws-namespace/c_RESTMessage...

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Ramesh,

you can try increasing the timeout for Outbound REST.

  • Property: glide.http.outbound.max_timeout
  • Description: Specifies the number of seconds that RESTMessageV2 and SOAPMessageV2 APIs wait for a response from a synchronous call. The maximum value is 30 seconds.

How to increase the timeout for a REST response? (ECCResponseTimeoutException)

https://hi.service-now.com/kb_view.do?sysparm_article=KB0694711

Another method is while you are consuming the Rest message using script you can use this method

setHttpTimeout(Number timeoutMs)

https://developer.servicenow.com/dev.do#!/reference/api/orlando/server/sn_ws-namespace/c_RESTMessage...

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I have used MID server then  i created this property 

  • Property: glide.http.outbound.max_timeout
  • Description: Specifies the number of seconds that RESTMessageV2 and SOAPMessageV2 APIs wait for a response from a synchronous call. The maximum value is 30 seconds.

Now its working as expected

So documentation says if its set to a higher value it will default to 30 secs, so in order to achieve this first step would be to set the property to false glide.http.outbound.max_timeout and add glide.rest.outbound.ecc_response.timeout to a higher value than 300 secs which is default

Also how to set sm.setHttpTimeout(6000) if REST API call is being made via flow action

VaranAwesomenow_0-1667681184645.png

VaranAwesomenow_1-1667682006585.png

 

VaranAwesomenow_2-1667682146581.png

 

Tejas Tamboli
Giga Guru

Hello Ramesh,

Default quota rules:-

https://docs.servicenow.com/csh?topicname=c_DefaultQuotaRules.html&version=jakarta

 

  • 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.

 

Long-running SOAP request support

https://docs.servicenow.com/bundle/madrid-application-development/page/integrate/inbound-soap/refere...

 

 

I hope this will help you.

Mark Correct if this solves your issue and also mark ???? Helpful if you find my response useful to you and help others to find information faster.

Thanks,
Tejas