Hello,
We have REST APIs which run for several minutes in our environment. It seems like these APIs don't cause time-out.
Is there a timeout in an Exposed REST API? If exists, where can I change the timeout value?
I couldn't find such a description in the documentation (https://success.outsystems.com/Documentation/10/Extensibility_and_Integration/REST/Expose_REST_APIs).
Regards,
Junji Watanabe
We have gotten an answer from support.
I share it for the people who have the same question.
There is no official document or information about Exposed REST API's timeout value.
Because REST APIs are intended for quick operations.
Hi Junji,
Checkout this discussion.
This may help you.
Regard
Seema
Seema Pandey wrote:
Hi Seema,Thank you for your quick response.I read the discussion you mentioned and found that it is about how to terminate APIs before the OutSystems Platform's time-out.But what I want to know is if Exposed REST API causes time-outs and has time-out setting.We have multiple REST APIs that run for several minutes in a production environment.So, if REST APIs have time-outs, we would like to extend the time-outs values not to cause errors.If there is no time-out, we can safely ignore them.Regards,Junji Watanabe
Please find the image below, where you can set the timeout of your api, by default time out is 100sec.
Manish Jawla
Manish Jawla wrote:
Hi Manish,
Thank you for your reply.
Consumed REST API Method has "Timeout in Seconds" property, but Exposed REST API Method does not have a timeout property.
HI Junji,
As mentioned by Deniel on this post. You can set timeout inside your exposed API action by calling SetRequestTimeout of HttpRequestHandler extension.
You have to add depedency of this action before using it in yor application.
Nikhil Gaur wrote:
Hi Nikhil,
I add reference to SetRequestTimeout of HttpRequestHandler and use it in my application.
The result is:
This is the same behavior as what Tiago Peres wrote in a reply in the discussion you mentioned.
Your sugestion is valid but is not working for the OutSystems REST services.
I don't understand why, but I've tried everthing! From using the "SetRequestTimeout", using Factory Configuration app approach to override web.config and even using machine.config.
The screen requests (post and ajax) and the SOAP services, all timeout as expected.
The REST services just run forever... I did not found a limit...
So, I do not know why it is, but SetRequestTimeout does not seem to work in Exposed REST API Methods.
Maybe I should ask support about this.
When I receive a solution, I will share it here.
Junji Watanabe wrote:
Yes, you can ask support and meanwhile you can use wrapper pattern suggested on the same post for aborting service execution after after given timeout.
Hi Nikhi,
I have already asked support about Exposed REST API Method's timeout.
Regarding your suggestion, what I would like to assure is that my methods do not abort with timeout.
Thank you.
I have a suggestion for you, usually if you are exposing any API they should not take much time like in your case you want more than minutes to execute them, i have 2 suggestions for you, either you can optimize your API code or you can have 2 APIs, first api call will trigger asynchronous process like timer to complete the execute and in the end you can again set/call another API call to post the result. Just work around.
I agree that Exposed REST APIs should not take much time.
Someone on the team decided to use REST APIs for a batch job template, and many programs have written based on it. So, I am trying to find out if timeout exists and can be changed.
Depending on the result of research, maybe I will have to change the design. In that case, I will draw on your advice.
where is the answer that you got from support